Let's get this out of the way first; we all compare ourselves to other people. It's part of human nature.
Sometimes we compare so that we can feel better about ourselves and our situations and sometimes we compare so that we feel worse about ourselves.
We all do it, there is nothing wrong with you that you compare yourself, you're not a bad person.
Now that's out of the way, let's talk about why comparing can be faulty and ends up making ourselves feel crappy either way.
First, we usually compare things that others make public. You see that your neighbour is always well-dressed, impeccably groomed, with fancy coffee in hand at all time. You look down at our tattered active wear (that is actually your "I can't be bothered to put on real pants today" wear) and feel less than.
What you don't see is the anxiety and perfectionism that is driving that glossy sheen. Or maybe your neighbour is actually super happy and her appearance just matches that happiness. You don't know. All you can see is the outside.
Comparing your inner mess to someone's pristine exterior is setting you up to lose.
Another problem with comparison is that you may make the incorrect assumption that what someone else is doing is right, so you must be wrong. However, unfortunately, people are making unhealthy choices all the time so you may be using a dysfunctional benchmark.
Just because your fancy neighbour thinks that it's important to only eat food that is the colour green, doesn't mean she's necessarily right.
Finally, comparisons often don't take into consideration your own priorities, experiences, goals and values.
You may feel bad that you don't throw your kids the most epic Pinterest-influenced kid parties, but do you truly care? Is that what is important to you or do you feel pressure because your glossy neighbour is also an amazing party thrower?
When you do find yourself comparing yourself, take a deep breath and become aware of the comparison and how you feel about it?