Something I would add to what Paracelsus listed, something I find helpful because my ambien stops working affectively over time, and for some people odd things like sleep walking, driving, shopping, among other things can occur at larger doses, some folks at any dose, is drinking some Montmorency tart cherry juice, I buy the brand Indian Summer as it is only part concentrate, some brands are 100% concentrate and you have to find the right mixture. Why Montmorency cherry juice?
Montmorency tart cherry juice tastes great and it also has naturally occuring melatonin in it, (roughly.013 mg per gram) and it also has tryptophan, you know that stuff that is in turkey that everyone always says makes them sleepy, tryptophan is used by our body to make both Seratonin and melatonin. Perhaps it is in my head but I feel it helps me, although melatonin itself does not, and I use it when I make cannabis gummies which I think also helps with sleep. A word of caution, however, Watch out for cheap juices with added sugars which is a negative, the concentrate will alleviate this and you dont need much of it if you need or want to avoid the sugars added because of the sour taste and of course they have to pack sugar in everything these days.
Allergies are also an issue, make sure you are not allergic, I know many people who have never heard of these cherries thus have never had them and have no clue about possible allergies. Then you have potential interactions with the same drugs that could interact with melatonin, considering there is more melatonin in montmorency cherries than any other cherry, some interactions include anticoagulants, anticonvulsants, diabetes meds, high blood pressure meds, Immunosuppressants, and caffeine. Most people are not drinking caffeine with their melatonin because they are trying to sleep, but remembering some things like tea have naturally occuring caffeine in it, it you drink tea to take your mealatonin the caffeine can block the bodies ability to absorb melatonin and lead to a build up melatonin. Supplements are not regulated like many meds and some have been found with added seratonin and a buildup of serotonin can lead to serotonin syndrome. All good things to look into before taking something like melatonin or drinking cherry juice which naturally contains it.