Sweat glands are used to regulate temperature and remove waste by secreting water, sodium salts, and nitrogenous waste (such as urea) onto the skin surface.