How to stop projecting.

In the homework I’ve noticed that many of my judgements about others are the same things I judge myself for. Now I’m aware of this, how can I break the pattern – would you recommend working on my opinion of myself, or focusing on a relationship? I think there’s still a part of me that believes judging is a way to push myself to be better and without that ‘whip’ I’d loose motivation. Thank you!