The aforementioned quote is attributed to Theodore Roosevelt. I've been thinking about this lately as I try to plan for what's ahead and what I want. I think one has to be able to decide what one wants independently of what other people are doing.
As a concrete example, it's easy to fall into the trap of "Oh, this other person in my field did X and now they are making so much money, should I take that path as well?" In a situation like this it's helpful to ask yourself if "more money" is really what you want. Sure, "more money" is always good, but you need to consider what you are giving up in exchange for that money. Is X really something you want to be doing? Or would you be miserable doing it? Sometimes you decide that the tradeoff is okay, I'll give up a little happiness in exchange for a little more money, and that's fine if that's what you really want. But that conclusion should come from knowing what it is you want and you need, not out of envy for what other people have.
It's especially difficult to avoid comparison to other people in the modern age of social media. It's just another form of FOMO. You have to remember that what people project on social media isn't often the entire picture of their lives. They are more likely to hold back on the failures, troubles, problems, and other negative aspects that they have to go through. Comparing your own life to others on social media is inherently an imbalanced situation - you will have a tendency to compare your worst days against their best days.
It can also be challenging and tempting to compare yourself to other people when you find yourself wanting to make unconventional choices. In such a case, even society itself will sometimes challenge you with comparison. It's important to have a firm understanding of what you want for yourself, to avoid falling into the trap of letting comparison decide to take away your joy.
I guess the saying isn't absolute. Comparison can be a good thing, as long as it's used in service of what you truly want.