I can relate to this a bit. I mean, there's the good ol' fashioned insomnia and nightmare thing, but in addition to that I was attacked in my sleep by my mother a few times as a kid, so feeling safe is the only way I finally could sleep at night for more than a few hours.
Certain things that have helped me sleep over the years in my healing:
1. Having a pit bull that sleeps next to my bed
2. Locked doors
3. trying to ensure as much quiet as possible while in my living space (example: in my roommate ads I emphasize being quiet is a must)
4. Pot cookies --- stronger than smoking it and won't hurt your lungs/throat, and no creepy side effects (except I get sore shoulders from sleeping in a weird position lol)
Everyone is different and I'm not advocating anything that would get you in any trouble or hurt you. I have my medical cannabis card and it's the only medication I take. I realize some folks react bad to cannabis or live in places where you can go to jail (like most of US still) so I don't mean to be controversial.
Feeling unsafe pretty much affects all parts of my life. Eating, sleeping, sex (or lack of sex drive for me), concentration at work... everything.
I have a giant knife between my mattresses with handle out for grabbing (yes, it fell out once and I stabbed my hand lol) and weapons hidden all over. I know it means I still don't feel 100% safe, but having weapons hidden around gives me a different scenario in my imagination of what "could" happen.
I am also planning to return to martial arts training to feel safer. When I was taking Jiu Jitsu, I felt great! This particular martial art is (in my opinion) the best rape defense for women. It can be highly triggering in your training, so I won't describe it here. If interested in this type of stuff, feel free to PM me.
These are my things to feel safe. You must find your own. I just offered these to give you some ideas :)