I live an equal distance from both cities. I have been to Trier thrice and Heidelberg twice.
IMHO, I think Trier is a better tourist destination. The Roman ruins (Ampitheater/Porta Nigra/baths) along with Karl Marx' house are a bit more eclectic than Heidelberg. Heidelberg's castle and Marketplace are nice but pretty much the norm for Germany. If you have not seen the castles and such - Heidelberg may be better.
On the other hand - if you have enough time - Chateau Vianden in Luxembourg (near Trier) is as nice as any castle I have seen in Germany.
I have debated this same question with many visitors who have come to see us in Germany!