The problem here is who people compare themselves to. Whatever your perceived flaw or weakness is, is what you seek the opposite of in others to compare yourself to. Someone who thinks they are "ugly" doesn't take note of all the other "ugly" people, they will compare themselves to the "pretty" ones. The interconnecting of our world, the internet, has caused great issues in this area.
The next flaw to comparing is the grass is always greener on the other side fallacy. Sure, the grass looks greener when you are on the outside, but when you look into it, you will often find that most people's yards are full of weeds.
Ultimately, what others do, how well off they are or how wonderful their lives are is completely irrelevant to you. They are different people with different mindsets (the most import factor here), different environmental circumstances, different family and friends, different genetics, and so forth. The time you waste comparing to them is the same amount of time you lost that could had been spent bettering yourself, enjoying yourself or doing something overall more productive.
In life, we are often our own worst enemy. We lay these self defeating traps for us to fall into. The only time you need to be comparing yourself to others is, like in competitive sports, when you are using those comparisons for motivation in improving yourself.