I've had insomnia for many years. At first some mild things would do the job, an otc antihistamine like unisom I could cut into pieces and each piece did the job. They quit working and I went to stronger and stronger things. Melatonin helps but will not do the job anymore on its own and I dont want to take huge doses like 10 to 30mg. A half a tab helps if I use along with something else. I've started epo and I think it helps
The only thing that consistently works is THC. My tolerance has gone up and up but it still works as long as I take a night off once in a while. Its the worst thing to take something that doesn't work, I feel like hell the next day and it takes days of sleeping normally to get over it. On the days off, I take a bunch of weaker stuff that usually works, not always
Now we get to the strong stuff, things like benzos which are only good for occasional use. Benzodiazepines come in over 100 varieties and are all addictive and require larger doses if you keep taking them. I occasionally hear from someone who takes a small amount every night and it always seems to work. That is the rare exception, they are not for every day use. You shouldn't even have them in the house because you will become tempted to use it too much
Other things that work but are also dangerous include Z drugs like zopiclone which may be slightly less problematic than benzos but are a problem with longer term use like needing more and more, not doing the job, side effects like nasty taste in the mouth, etc
One I take occasionally is phenibut. Its not a benzo or a z drug, it has hypnotic and sedative properties. Some people take it before going out because it makes them more sociable and relaxed. It will help wiith sleep, it may have a hangover the next day. If I have been sleeping poorly and the usual stuff leaves me waking in the middle of the night, I can take a 300mg phenibut along with my usual stuff and have a delightful night sleep. I know better than to use it every night but its a great little arrow to have in your quiver.
Tension, arguments, anxiety, repetitive thoughts that won't stop, these are things that make it hard to sleep or which can cause fragmented sleep. Many other causes as well. I do all the sleep hygiene stuff, no screens at night, no exercise, try to relax. All that helps