R’ Nachman of Breslov taught that when you judge someone favorably, Hashem judges that person the same way that you judged him.
For example, if you see someone eating food that is not kosher, but you think to yourself that he must be eating it for health reasons and has no other choice, Hashem will actually judge that person as if he has health issues and has no choice! How you judge, that is how Hashem will judge!
Can you imagine if we would all just judge people favorably?!