Well, Xanax is a benzodiazepine drug, and can be highly addictive. The one time I took it, I only took 1/4 of a pill, and I was kind of out of it for about 24 hours! (But then, I'm more sensitive to medicine than most people). For some people, it really does seem to work, but it's best to take it on a short-term basis, so that you do not become addicted.
Ambien is a good sleep aid, but again, I only took 1/2 a pill, and it knocked me out for about 4 hours. The quality of sleep, for me at least, was kind of strange. When I woke up, I felt as if I had been knocked out, not that I was waking up naturally. Other people may have a different opinion of this drug, however.
I never took sleep aids before, either, so this has been a new and sometimes frustrating experience for me. Right now, I'm taking a combination tablet that contains melatonin and valerian root, plus I take two magnesium chloride tablets an hour before bedtime. It works most of the time, but I still have a problem on some nights. I have pulsatile tinnitus and it is really difficult to fall asleep.