This is true in typical sleep. The way our sleep cycles work typically are as follow:
You go from Wake to NREM sleep. From NREM sleep you enter either REM or you wake back up. In healthy sleep you can only enter REM sleep from NREM sleep. After REM you then would enter a brief wake period or light NREM sleep stage(N1,N2), before entering into NREM sleep again. People with Sleep disorders can enter REM from wake(narcolepsy), but this is not normal.


IN the images above you will see stage 3 sleep(known as slow wave NREM sleep) will dominate the first half of your sleep, then REM episodes are longest at the end of the night. You also will see that you must enter REM from NREM sleep.
Both stages of sleep are important for different reasons.

Sleep is homeostatically regulated meaning that when you deprive yourself of sleep, you compensate for that sleep loss by trying to recover the lost sleep(this is known as sleep rebound). Essentially the longer you deprive yourself of sleep, the greater your need for sleep is.
(Sleep drive is proportional to the duration of prior wakefulness). The thing is lost sleep is never completely recovered. It takes someone 1 day to ārecoverā from 1 hour of sleep loss(i.e. if you lost 6 hours of sleep it would take you 6 days to ārecoverā that sleep loss). I have recover in quotes, beacsue the meaning of recover in this sense is to go back to normal sleep cycles or that sleep homeostatis is regained.
The same holds true for specific sleep stages.
Sleep loss promotes increase in sleep need, meaning you will see an increase in NREM and REM sleep rebound during sleep. Your body will first try to recover its NREM sleep need first, meaning you will undergo little to no REM sleep during your first few nights of sleep recovery. Then REM sleep recovery will occur. Only substantial sleep deprivation (12-24 hours) causes significant REM sleep rebound
Say someone undergoes 12 hours of sleep deprivation one night. When you enter sleep to recover after the sleep deprivation your body will try to recover NREM sleep first. After your body recovers its NREM sleep need, the subsequent nights you would experience an increase in REM duration and intensity. This is becasue your body is trying to recover the REM sleep loss it experienced(i.e. your dreams will be intense and occur frequently until your body has ārecoveredā from the REM loss).
I hope this made some sort of sense, as this is really hard to explain over text.
I also want to add some facts about sleep loss , that I typically see individuals misunderstand about sleep:
-Individuals may vary somewhat in their tolerance to the effects of sleep loss, but are not able to accurately judge this themselves.
-Sleep needs are genetically determined and cannot be changed. i.e. you cannot ālearnā to sleep less.
-Human beings do not āadaptā to getting less sleep than they need.
-Although performance of tasks may improve somewhat with effort, optimal performance and consistency of performance do not! Studies show that sleepy people underestimate their level of sleepiness and overestimate their alertness.
-The sleepier you are, the less accurate your perception of degree of impairment.
-You can fall asleep briefly (āmicrosleepsā) without knowing it.
-Portions of your cortex can enter a sleep-like state during waking.