The fact that you "have nightmares" proves you are getting at least some sleep, maybe not as sound as you want, but you are sleeping. I suspect part of the problem is "catastrophizing" all this, making it seem worse than it really is. By letting go -- or at least trying to let go -- some of the worry, you probably will be able to sleep better.
To be sure though, see your doc for a checkup. But beware taking sleeping pills or any substance for sleep. There are better ways, including drug-free CBT sleep training methods, that you should probably try first if needed.