I keep doing this, i turn over to go to sleep and just as i'm drifting off i have like a mini dream. I know i'm not asleep whilst i'm thinking about it. Is it a dream or just my thoughts going crazy?

Like, last night, just before i slept, i was like dreaming/imagining a burger van or something like that but i knew i was wary of going in there but i wasn't sure why.

Anyone help me out? Tell me why on earth i have these mini dreams and what they are?