Regeneration, removal of metabolic waste products from the brain, recording long-term memory.
In humans, the rest of the body needs only rest, and will do its regenerative thing whenever sufficiently relaxed even if awake, but the brain has a hard requirement for actual sleep.
Which means that sleep is specifically a brain function.
Fun-ish fact: dolphins in captivity will do human-style eyes-closed sleep. But only in captivity, presumably because captivity is the only place where it's devoid of predators and therefore safe enough to do that.
Dolphins must normally make a conscious effort to breathe, but they also have a tail-kick reflex that activates when fully asleep. This keeps their blowhole above the water line.
@kitten From what I understand, it's largely as a way to offload/dump excess information, reset things, regain energy, etc, which is also what dreams appear to be (the brain processing, sorting, and dumping unneccessary information collected while awake)