If a person has problems falling asleep, and he puts on music to sleep better, and there is a problem with falling asleep for a long time, then it is better to contact a specialist and solve the problem of sleep. If a person does not depend on listening and does it situationally, then it's okay, it can be done.
The only thing that is better not to use modern gadgets - a computer, a phone - so that light does not enter the eyes, because otherwise the process of production of melatonin, a hormone that determines sleep patterns, is disrupted. But this is not recommended for children, not even music, but cartoons, games before bedtime. Parents often make this mistake and stage cartoons. In a child, the process of falling asleep may be associated with watching cartoons, and in this case, the teenager will develop persistent insomnia.