I’ve wondered similar before, as I broke an x4 rear derailleur.
If you Google X5 vs x7 or x7 vs x9 etc. It returns a fair few results.
What I could gather is each higher level you go you get slight improvements in materials/function.
Be aware of second hand though, as a brand new x5 might well be as good as an older model x7 from years ago as they seem to trickle down the certain features when they revise models and something new comes in at the top end.
For what it’s worth I went with a new x7 rear mech in the end, which works well, certainly better than the x4 in a number of ways shifts smoother, was easier to set up etc.