Xerath is a person who had a just cause, a good reason to strike out against some bad people, and some really, really, shit luck combined with a willingness to go way too far.
Xerath did what he did because Shurima was an empire with slavery. They had kept him and countless others enslaved for years, and he knew the only way to fix that was with something drastic. So he sabotages the Ascension ritual of his master and gets ready to attain power, something he never had. I don't think it's fully clarified if he knew how big the blowback from his sabotage would be (He killed a TON of innocent people), but maybe he didn't really care. That's the taking it too far bit.
The real tragedy with Xerath's story is that he was convinced he was alone, ignored, and hated because he was a slave. He never realized how much Azir cared about him, that he really thought of him as a friend, and that he thought slavery was as barbaric as Xerath did. He never got a chance to say it, and he waited too long to do something about it.
If we're talking current Xerath, I think all that remorse is washed away in both of them from millenia of imprisonment on Xerath's part and...death on Azir's. It doesn't sound like there's any friendship left, just revenge.
That's why I think Azir/Xerath's dynamic is sorely underrated, probably because it's a retcon of his original story and still from around that time when Lore was super tumultuous. There's a whole lot of the classic "If someone had just said SOMETHING" in there.