Give you some advice. In the short term, once you fall into that kind of fear again, you must force yourself not to think rationally and keep your mind blank. If you sleep with your head covered at night, find your relatives or good friends after getting up, communicate with them, listen to their understanding of death, and release your pressure by the way.
In the long run, you should enrich your life. If you are at school, you should take another class in your spare time to enrich yourself. If you are at work, you should set a work goal for yourself, so that your pressure can be transferred reasonably, and you won't have so much energy to think. Even if you think about that again, you just smile and do what you should do.
Besides, I don't think you have a girlfriend yet. Whether you are happy or sad, you won't feel particularly empty and lonely when you have someone you love to share with you. Find a cheerful girlfriend, she will be an angel who will "save" you from death in the shadow of fear.