If it prescribed, then no, however if taken recreationally, be careful.
With Ritalin being a CNS stimulant and Xanax being a benzo, they somewhat 'cancel each other out'. Xanax will take the edge of the adverse effects of Ritalin (rapid heartbeat, anxiety etc...).
Mixing uppers and downers isn't really smart, but tbh it depends on the dosage and method of use. As I said, if it is prescribed and simply for medical use, then you'll be fine.