You could take anxiety medication for sleep in a pinch, but be aware of how the drug might interact with other medications you might be taking already. Drinking alcohol while taking anxiety medications isn’t recommended because both slow your central nervous system (via the Centre for Addiction and Mental Health). If you overdose, you could stop breathing. Caffeine can interfere with the effectiveness of anxiety medications, particularly if you take them for insomnia.
If you take an anti-anxiety medication when you’re not feeling anxious, the drug isn’t fighting the chemicals that are making you anxious (via Greatist). Thus, you will be more likely to feel the drug’s side effects, such as impaired or altered thinking, balance issues, or grogginess (via GoodRx).
Don’t get into the habit of taking anxiety medication regularly to help you fall asleep. You could develop a tolerance to the medication, which will make it less effective at your normal dose. Taking anxiety medication regularly for sleep also increases your risk of depending on the medication for sleep (via Greatist).