My only problem with melatonin if I take it at bedtime is it wears off at about four hours and I’m wide awake; sort of like having a drink before bed, then waking up later.
I use it for a long nap when I’d like to crash for a few hours in the afternoon before a late show. For normal bedtime I go to sleep without it, and when I wake to use the restroom in the middle of the night I take one if I need to and have at least three-four hours before the alarm.