It’s a tool.
What matters is how you use that tool.
To compare yourself to others usually means feeling superior or inferior to the compared. But this takes different forms.
Proud people tend to view their superiors with envy and their inferiors with disgust. In both cases, the proud seek to grow in status, and they use comparison to fuel their pride.
Humble people, on the other hand, tend view their superiors with admiration and their inferiors with compassion. In both cases, the humble seek to grow in virtue, and they use comparison to fuel their humility and inform their personal growth.
Pride, not comparison, is the real thief of joy.
To be proud is to be human. But it takes humility to see that.