are sleeping tablets safe?

I've never had to take sleeping tablets in my life before but i'm currently surviving on my 4th day with a shit (excuse my language) nights sleep the night beforehand. I am absolutely exhausted, I have a university degree assessment coming up, which I need to work on, I can't even focus and I keep crying from lack of sleep and my poor body is so weak and lifeless. Are sleeping tablets safe? I've never had a problem with sleeping before & I will only take them when I'm really struggling (like now!!!!) to catch back up to even at least 6 hours of sleep a night just so I can (sort of) function again until I have the time to nap during the day and catch my sleep back up! I have an appointment tomorrow where of course I will ask my consultant about this BUT I don't think i can survive through a 4th night / 5th day with literally no sleep, so it would be nice to get some advice before I plan to go to bed tonight. I will only take them tonight if deemed safe & if I wake up after first dropping off. I would prefer to avoid them completely but needs are a must when my body is shutting down on me 🙃