yes, melatonin is unfortunately misused commonly, especially in the US, where it's not regulated for whatever reason. If you take 5 to 20 mg, it can act as an immediate sleep aid, by overwhelming your body with unnatural amounts, with a higher chance of side effects like nightmares. For reference, the body naturally produces about 30 mcg to signal itself to fall asleep [1].
If you actually want to shift your circadian rhythm, the optimal dose is about 300 to 500 mcg (the actual absorption rate varies wildly between manufacturers and delivery methods), taken 4 to 6 hours before your sleep onset (note: when you usually go to sleep, not when you want to go to sleep). [2]