When you get less sleep than you need at night you start to accumulate sleep debt which you’ll have to eventually pay back. Partial sleep deprivation will start to affect your attention & ability to learn new tasks. Unfortunately it usually needs to be paid back slowly. For example, adding an extra 20-30 minutes onto the number of hours of sleep you normally need.
Going for 24 hours without sleep (i.e., pulling an all-nighter) can be dangerous. Once totally sleep deprived people often experience microsleeps where they’re conscious but not really aware of what’s going on around them. It tends to make people less productive at work, more likely to have mood problems, and puts them at a greater risk for car accidents.