Water, ions and urea leave the body in several ways. Water leaves through the lungs during exhalation. Water, ions and urea are lost from the skin in sweat. There is no control over water, ion or urea loss by the lungs or skin, so the kidneys remove any excess water, ions and urea in the urine.
The amount of water matters because cells exchange water with the fluid around them by osmosis. If body cells lose or gain too much water by osmosis, they do not function efficiently.
The kidneys produce urine in two stages. First the blood is filtered, which pushes small molecules such as water, glucose, ions and urea out of the blood. Then useful substances such as all the glucose, some ions and water are reabsorbed back into the blood by selective reabsorption. The urea and the excess ions and water are not taken back, so they leave in the urine. In a table of results, glucose is present before filtration and after reabsorption but is absent from urine.
Higher tier only: digesting protein can leave excess amino acids. In the liver they are deaminated to form ammonia, which is toxic, so it is immediately converted to urea. The pituitary gland releases the hormone ADH when the blood is too concentrated. ADH makes the kidney tubules more permeable to water, so more water is reabsorbed into the blood. This is controlled by negative feedback.
People with kidney failure can be treated with a kidney transplant or by kidney dialysis. In dialysis the blood passes alongside a partially permeable membrane, and waste such as urea diffuses out into the dialysis fluid. The fluid contains normal levels of useful substances so these are not lost from the blood.