Dreams can seem very real and can be upsetting. Sometimes we are trying to work things out subconsciously. Sometimes they are just meaningless nonsense. Sometimes they take off from something we were watching, listening to or thinking about right before we drifted to sleep. Yours sounds very riddled in your anxiety. Do you do anything to address anxiety? And when you say 'it keeps happening' ,what do you mean? That you keep getting nervous when reflecting on the night mare or that you had a similar situation 2 years ago?
First, it doesn't happen very often, so it's not really a problem unless you magnify it into one. Second, dreams are always weird. Nobody likes nightmares, and they can be draining to wake up from. Dreams on the other hand are pleasant and easy to wake up from. When we get a lot of nightmares it may be our lives aren't going well and that enters our sleep and affects our dreams. But in your case, you don't say if what you're dreaming is connected with anything in your real life. I have a phobia problem, and my dreams are always me in a phobic situation. Not fun, and this has only started happening the last few years as I've gotten old and had a bad reaction to a medication. Before that, it didn't happen. But in your case, it's very occasional, not all the time. But dreams can be useful, you can look at them and see if they have anything interesting to ponder or learn from. When I was writing fiction before my med problem, dreams became short stories. Meaning, you can either make them an interesting part of life or you can make them into something that becomes a chronic problem. So I would look to the content and see if it is something in your actual life that is bothering you, and if not, it's just stuff your brain is doing because that's part of how our brains do some housecleaning. Peace.