In what way are you comparing yourself to others?
If you mean your appearance, then general Body dysmorphic disorder (BDD) treatment is a good idea (Even if you don't have BDD)
If it's something more general, then Dialectical Behavior Therapy (DBT) might be something beneficial to you.
And by "treatment", I mean that mainly broadly. You
can go to a therapist if you or your health insurance can afford that, but self treatment at home can also be helpful.
For me, the
BDD Workbook by James Claiborn and Cherlene Pedrick RN helped me out quite a bit. I've also bought
The Dialectical Behavior Therapy Skills Workbook and
The DBT Deck.
In general, I would say that the DBT book and deck didn't really help me much, but I've heard it help many others. I think it depends on the person. As
@NumbItAll said, if it's appearance based/social media based, one of the best things you can do is probably avoid social media in general.