Our neurons still function while we sleep, but because we are not dealing with any life activities at the time, there is nothing to attend to or deal with at the time. As a result, the neuronal firings produce bizarre images and combinations, not coherent meaningful combinations. Thus, dreams are just all the irrelevant neuronal firings being lumped together. There are many different types of sleep disorders. Some involve an inability to sleep, and others involve an inability to avoid sleep.
Insomnia is a disorder that exists for long periods of time and has serious consequences.
In addition, insomnia may be related to an inability to fall asleep at the beginning of the night, an inability to stay asleep during the night, or an inability to go back to sleep after an awakening at some point. On the other hand, parasomnia is an inability to not sleep. In both of these disorders, the effects cause disturbances to normal functioning on a daily basis. When we are awake, events that occur around us have significant effects on our thoughts and behaviors. Just because we are sleeping does not mean that our brains, our senses, and our nervous systems shut down.