How is it possible to drive while "asleep" (or while drunk)?

First of all, I have never and would never drink and drive. However, I confess that there have been a very few occasions (one very recently) in which I was absolutely exhausted while driving on the highway, and in my exhausted state, didn't even realize that I was continuously falling asleep at the wheel... I just go numb and jolt awake and realize that I have been just drifted for a few seconds, and this happens for several minutes before I truly become cognizant of the fact that I am actually falling asleep at the wheel and need to get off the road. As terrifying as these events can be, I am fascinated by the science behind this. Obviously when this happens, I am not actually closing my eyes and going to sleep, otherwise the odds that I would still be alive are astronomical. I read that this can happen when exhausted and some parts of the brain shut down, but others are still awake. When this happens I am completely unconscious of what I am doing, and yet maintain control of the vehicle for several moments at a time. I am sure this is a similar sensation to drunk driving? In which you black in and out of consciousness but were more or less still "driving the car" (unless of course you crash). I know it's bad, but what is going on here in the brain?

Dixon2021-04-05T17:57:56Z

This is what is called Procedural Memory. Essentially it is a task that has become embedded such that it doesn't require conscious thought, ie you don't actually need to "remember" it. When you drive (even normally) you don't think about moving your feet or your hands etc. and in fact as long as you can see the road ahead it can mostly all happen automatically. 

However, the thing with driving is that sooner or later something always happens that does require conscious intervention.

Jim2021-04-05T15:37:53Z

Law Enforcement codes DUIA as driving asleep under the influence of Ambian.
So I'd say yes.