Yes melatonin pills are safe for short term use.
However if you continue taking melatonin pills they can become unhealthy and unsafe.
But melatonin pills are much safer to take long term than regular sleeping pills and melatonin pills are also less addictive and less habit forming than regular sleeping pills.
Our bodies naturally produce melatonin which is a natural sleep hormone that helps us fall asleep, stay asleep and wake up refreshed.
But sometimes our bodies may not produce enough melatonin and then we need to take some melatonin pills to increase our bodies melatonin levels.
It's okay and safe to take some melatonin pills for the short term but you should try to do other things to hopefully help you sleep.