If both have Shadow Claw and Shadow Ball why pick/use Haunter in PvP?
Levels matter. Since Haunter has a much higher level than Gengar at CP1500, it will likely out-damage and be tanker than Gengar.
But yes Gengar will definitely perform better in UL.
At Great League 1500CP, Stat-wise they are near enough identical. Gengar actually has a tiny bit more bulk.
What sets the two apart is their moveset. Haunter has access to Shadow Punch, which has a cheap energy cost - not a great deal of power, but thanks to his high ATK stat (and STAB) it still hits pretty hard. All of Gengar’s moves are moderately expensive, which is potentially a real problem given how frail it is.
So, if you’re going for a strict Shadow Claw & Shadow Ball moveset, there’s going to be little difference between them, but Gengar potentially the slightly better option. If you want to purchase second moves, then grab Shadow Punch on Haunter and use that.
Level doesn’t matter. Stats repartition does. Attack stat over sum of total base stats for Gengar is 0.46, Haunter is 0.49. Meaning… exactly what @Skywalkered said actually!