I really used to hate fighting Xerath, mostly because I play
who's pretty much useless against him and permabanned him every game when I had a ban chance.
In the laning phase, don't stand in your minions, position yourself so he can't hit you AND the minions at the same time with his Q, or any other ability really. Shove him to turret and get some boots early so you're able to dodge his skillshots. If needed, get edge of night or banshee's veil depending on your champion. If he chooses to shove the lane with Q without attacking you with his Q, you can go in for a trade. Be careful of his passive and E, trade if you aren't too scared to give him a little mana.
In mid/late game, his Q will really, REALLY hurt you. In teamfights try to get your team to engage first so you aren't poked down with 900 damage Q's every 5 seconds. Focus him, he does high AOE damage. A little cc will ruin his day.
Overall he's immobile but does a ton of damage with a slow/stun to get away while being a pretty strong laner with sustain. If you cc him though, he's an easy kill. If you have decent waveclear, a gapcloser and have a bit of damage you can stand up to Xerath. Also, take advantage of his cooldowns. Especially the thing he's gonna spam which is his Q.