The phase of sleep with the most realistic dreams is the REM phase. During this phase there is a physiological muscle paralysis (excluding the muscles used during respiration and the muscles responsible for eye movement). This incapacitation in your own body during the REM phase aims to prevent you from causing harm to yourself and others. The sleep paralysis, called metaphorically “the terror that comes in the night”, occurs when the cataplexy happens during a sudden awakening from sleep in the REM phase or when a person is falling asleep but before he loses consciousness.
During the pandemic, my sister and I developed a manual on what to do to get out of sleep paralysis.