God, people can be so harsh.
It's a really crappy situation to be in when you're still getting over being hurt by him. However - and it sounds easier than it is - but if you're going to have to see them around each other a lot, the best thing you can do is tell yourself that he might not have treated you as nicely as he treats her, but you'll find someone who does. We've all had an ex (I know he was a FWB, but still) that has treated us like crap and then treated the next person great, but sadly that's just how it is, and sometimes there is no rhyme or reason to it. If he's your friend, he isn't trying to hurt you by being around this girl. He probably thinks you guys are okay and doesn't understand why it would hurt you, but then again, it sounds like he's very inexperienced so wouldn't know how it feels. One day he sadly will as most people have to go through heartbreak at some point. You could always say you him that it's hurting you a bit, but then he might choose her over you, which if your relationship is a bit rocky and he's interested in her, it is a strong possibility. Also, it wouldn't be fair to put him in that position.
Maybe you could befriend the girl? After all, if you have something in common with X, you probably have something in common with her. Sometimes we characterise our ex's new interest badly simply because they are our ex's new interest, when really they're a person too. She hasn't done anything wrong, so maybe it could make it easier on you by getting to know her?