(and does righteous deeds, and says: "I am one of the Muslims.") means, he himself follows that which he says, so it benefits him as well as others. He is not one of those who enjoin good but do not do it themselves, or who forbid evil yet they do it themselves. He does good and avoids doing evil, and he calls people to their Creator, may He be blessed and exalted. This is general in meaning and applies to everyone who calls people to what is good and is himself guided by what he says. The Messenger of Allah ﷺ is the foremost among people in this regard, as Muhammad bin Sirin, As-Suddi and `Abdur-Rahman bin Zayd bin Aslam said. It was also said that what was meant here is the righteous Mu'adhdhin, as it was mentioned in Sahih Muslim:
وَلَا تَسْتَوِي الْحَسَنَةُ وَلَا السَّيِّئَةُ (And good and evil are not equal - 34). The special instructions for those who are engaged in calling others towards Allah commence from here. The gist of these instructions is not to repay evil with evil, but to be patient and to be obliging ادْفَعْ بِالَّتِي هِيَ أَحْسَنُ (Repel (evil) with what is best, - 34) means that the habit of those people who are engaged in calling others towards Allah should be to reply to the evil behavior of the addressees in the best possible manner. No doubt, it is good not to repay evil with evil and to forgive, but it is much better to do some good to the evil-doer after forgiving him. Sayyidna Ibn ` Abbas ؓ has said that the instruction in this verse is to be patient with the one who is expressing his anger with you, to be tolerant and forbearing with the one who is being ignorant with you and to forgive the one who has made you suffer. (Mazhari)
Some narrations have it that someone either abused or reviled Sayyidna Abu Bakr ؓ who said to him, ` If what you are saying is true that I am at fault and am bad, then I pray Allah Ta’ ala to forgive me, and if you have told a lie then may Allah Forgive you. (Qurtubi)
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 36–37
The call of the Quran is to invite people to God. Bringing man closer to his Lord and Sustainer; making him spend his whole life in remembrance of God; developing a feeling in man that he should make the one and only God the centre of his attention—these are the real aims of the Quranic call and undoubtedly there is no call better than this. But, only that person becomes the preacher of God who is so sincere in his call that he, first of all, accepts whatever he wants others to accept. Whatever he exhorts others to do, he should have himself started doing from the outset. The greatest weapon of a preacher of Truth is his ability to treat people well. Even if people are not good to him, he should be good to them. He should adopt the policy of avoidance in the face of provocation or irritating behaviour and exercise patience under trying circumstances. Almighty God has made it possible for unilateral good behaviour to be immensely persuasive. The preacher of God is aware of this God-given asset, and uses it to the utmost extent, even although it may involve crushing his own feelings and killing the urge to retaliate. Whenever a caller to Truth has the feeling within him that it is necessary for him to retaliate against a particular instance of oppression in order to prevent the enemy from becoming so bold as to commit even greater excesses, he should immediately understand that this is a satanic inducement. It is the duty of every believer and preacher of Truth to seek the protection of God from such feelings instead of acting upon them.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.