How do I distinguish between rejecting evil in the heart and looking down on someone with contempt?
No, what does rejecting evil in the heart have to do with contempt? It has nothing to do with contempt.
Contempt is something—subhan Allah—rejecting evil and obedience are one thing, and contempt is a sin.
So how can rejecting evil be done with contempt? That doesn't work.
But the point is that rejecting evil is an obligation.
With the hand, and if he cannot, then with the tongue, and if he cannot, then with the heart.
And the scholars said that rejecting evil with the heart means that you leave what remains.
And it has been revealed to you in the Book that when you hear the verses of Allah being disbelieved in and mocked, do not sit with them until they engage in another topic.
Otherwise, you would then be like them. So, a person who rejects evil should get up; he should not stay and say, "I reject it in my heart." No, the one who rejects it in his heart gets up and leaves the place.