I think unisom sleep tablets are safe to take that far along, id check with my doctor before taking them of course. You’ll definitely want to be well rested before labor and you won’t be getting a lot of restful sleep afterwards so it wouldn’t hurt to try some.
I’ve had the insomnia and my fiancé is always asking why I’m up late lol, I tend to FaceTime my sister this late who’s also pregnant and only due a few days after me so she’s going through it too.