I often have this while playing with my phone on my bed. Usually waking up when my phone starts slipping out of my hand.
Luckily never had it while driving. One time when I was driving 6/7 hours at night I became very tired, but decided to have a nap at a parking lot until it was light. Better safe then sorry!