I think most of us have experienced something similar. It’s called “dreaming”. https://en.wikipedia.org/wiki/Dream
In the dream state, your brain is active with a bewildering variety of images, most of them emotionally loaded one way or another. The emotions triggered by your dreams may not even have any real connection to the thoughts going on in your head, and often a person will wake up in the middle of a dream with that emotion still vivid, but the content of the dream itself rather indistinct. I’ve awakened many times with a feeling of dread so powerful I was afraid to get out of bed. Every shadow, every object in my bedroom seemed full of menace (although I wouldn’t use the term “evil”). So it’s possible you’re simply experiencing a random emotion in your head, and for some reason you fixate on the door… excuse me, The Door, as the embodiment of that emotion.
Is it unusual for the door to be open or half open? For example, I generally keep my bedroom door closed when I got to bed, but sometimes when it’s hot I leave it half open. If I woke up in the middle of the night and forgot that I had left the door open, I suppose I might momentarily feel some alarm.
I hope I don’t cause any offense. I’m just trying to answer your question as honestly as it occurs to me to answer.