Xanax is mainly used to treat anxiety disorders and panic attacks. Brand names for cyclobenzaprine include Flexeril, Amrix, and Fexmid. Cyclobenzaprine and Xanax belong to different drug classes. Cyclobenzaprine is a muscle relaxant and Valium is a benzodiazepine.