Melatonin safe?

Is melatonin 5mg safe to take? I asked my doctor at my last appointment about something to help me sleep, he suggested lavender oil and Tylenol pm, I asked about melatonin and he told me I could take it, but it didn’t seem to be effective after a few days. My main concern in it being 5mg.