i'd like to add something, the body heats up a lot when sleep-deprived, this could be used by phantoms to track down weak targets, and mind you that you can die from sleep deprivaton
Idk if someone else has thought of this before, but hear me out on this new worldbuilding headcanon for Minecraft. Phantoms pose the same ecological role as IRL vultures. That being, they eat dead bodies. The reason a lot of them swarm (and even attack) the player when they haven't gotten sleep is because they sense lack of energy (which, for a lot of animals means death is nearby) and assume the player is either dead or dying.