Xanax is the most short acting out of the anti-anxiety agents. It is easy to build up a tolerance to it. There are other ones that are longer lasting and less likely for a person to build up a tolerance to. For example, I've been on Klonopin for 10 years and although I've had to raise it a few times under my psychiatrist's direction, its been effective. All of these medications called benzodiazepenes have a potential for building up a tolerance to and if used incorrectly additction. But Xanax was meant to be used short term. As always speak to your psychiatrist but there are anti-anxiety agents that are longer lasting and are far less likely to cause this effect.
It is not so much that the medication fails, its more like the underlying anxiety spikes, and the medication is not enough to quiet that. That is a real problem, but you and your doctor would be tempted to increase the dose, but xanax can become a very addicting medication, and really tough to stop if you keep on increasing the dose...Instead, try looking into the source of your anxiety and think of the xanax as something to take the edge off, rather than avoid the problem.