MC 1.18+
...
Tiredness

Player can only sleep when he's tired enough.
If too tired a "Tired" effect is added which decreases sight, movement speed, attack speed and mining speed. You're able to sleep during daytime if too tired.
Tiredness is gained at the same rate as Exhaustion.
Sleeping resets tiredness. If not sleeping when too tired, you also get a Vigour effect that reduces hunger consumption for 8 minutes.
Some foods (in vanilla only cookies) give the Energy Boost effect, decreasing Tiredness overtime.

MC 1.16+
...
Wake Up Hunger and Effects

When you wake up, your hunger bar is heavily depleted and you are slow and weak for a few seconds.
You're also not able to fall asleep if you're too hungry

MC 1.16+
...
General Sleeping

Sleeping can be disabled and while it's disabled you can even prevent the player for setting the spawn point. This feature is disabled by default.
As of 1.18.2 you can also enable sleeping during day to get night time.