There is a confusion among Christians as to what Matthew 18 teaches. So let us take a look.
When it comes to challenging a false teacher and I have had this similar point given to me, that we should speak to people privately if you have a concern about false teaching.
What does Matthew 18 and 1 Corinthians 5 actually say?
Firstly let's look at Matthew 18:
"15 “If your brother sins against you, go and tell him his fault, between you and him alone. If he listens to you, you have gained your brother. 16 But if he does not listen, take one or two others along with you, that every charge may be established by the evidence of two or three witnesses. 17 If he refuses to listen to them, tell it to the church. And if he refuses to listen even to the church, let him be to you as a Gentile and a tax collector. 18 Truly, I say to you, whatever you bind on earth shall be bound in heaven, and whatever you loose on earth shall be loosed[f] in heaven. 19 Again I say to you, if two of you agree on earth about anything they ask, it will be done for them by my Father in heaven. 20 For where two or three are gathered in my name, there am I among them.”"
This is not addressing false teachers or heretics, it is addressing the topic of what to do with a Christian that refuses to repent. Jesus is laying out the steps that a Christian should take if a Christian brother is engaging in sin and refuses to heed warnings and instructions from them.
1 Corinthians 5 explains the following:
"5 It is actually reported that there is sexual immorality among you, and of a kind that is not tolerated even among pagans, for a man has his father's wife. 2 And you are arrogant! Ought you not rather to mourn? Let him who has done this be removed from among you.
3 For though absent in body, I am present in spirit; and as if present, I have already pronounced judgment on the one who did such a thing. 4 When you are assembled in the name of the Lord Jesus and my spirit is present, with the power of our Lord Jesus, 5 you are to deliver this man to Satan for the destruction of the flesh, so that his spirit may be saved in the day of the Lord.[a]
6 Your boasting is not good. Do you not know that a little leaven leavens the whole lump? 7 Cleanse out the old leaven that you may be a new lump, as you really are unleavened. For Christ, our Passover lamb, has been sacrificed. 8 Let us therefore celebrate the festival, not with the old leaven, the leaven of malice and evil, but with the unleavened bread of sincerity and truth.
9 I wrote to you in my letter not to associate with sexually immoral people— 10 not at all meaning the sexually immoral of this world, or the greedy and swindlers, or idolaters, since then you would need to go out of the world. 11 But now I am writing to you not to associate with anyone who bears the name of brother if he is guilty of sexual immorality or greed, or is an idolater, reviler, drunkard, or swindler—not even to eat with such a one. 12 For what have I to do with judging outsiders? Is it not those inside the church[b] whom you are to judge? 13 God judges[c] those outside. “Purge the evil person from among you.”"
Paul further expands on what Jesus said regarding putting unrepentant Christians out of the church and goes as far as telling us not to even eat with that person, until there is sincere repentance.
Some would point to Jesus eating with tax collectors though they completely miss the point of that section. Firstly, the people that Jesus was eating with were not his followers and secondly, his intention was to bring them to repentance, NOT to let them continue in their life style. You cannot compare Jesus' compassion on sinners and his mission of repentance to Jesus' discipline in the life of the church.
When it comes to heresy, It is quite possible to challenge someone as found in Matthew 18, but that is to do with the church, it has nothing to do with another person who is a wolf in sheeps clothing misleading the flock.
Jesus tells us to beware of false teachers (Matthew 7:15) and John even tells us not to even with or greet false teachers lest we partake of their evil works (2 John 1:10). Heretics are people who are lost, they need to be prayed for and witnessed to, but a an unrepentant heretic is to be marked and warned. You cannot go to a false teacher in private, The false teacher is proclaiming his teaching in public, so therefore it stands to reason that he is to be marked, exposed and refuted in public. Matthew 18 is not addressing what to do with heretics in public, it's addressing what to do with a Christian in a local congregation.
In fact this is what Paul, by the authority of Jesus, told us to do with heretics if they refuse to repent:
"8 The saying is trustworthy, and I want you to insist on these things, so that those who have believed in God may be careful to devote themselves to good works. These things are excellent and profitable for people. 9 But avoid foolish controversies, genealogies, dissensions, and quarrels about the law, for they are unprofitable and worthless. 10 As for a person who stirs up division, after warning him once and then twice, have nothing more to do with him, 11 knowing that such a person is warped and sinful; he is self-condemned."
Heretics trying to divide those united IN TRUTH and cause ACTUAL division (I emphasize truth and actual because some falsely use division as an excuse to justify ecumenism or a refusal to expose false teachings) must be marked and separated from.
Some complain when names are mentioned when it comes to false teachers, that we shouldn't name names. I'm sorry, doth my ears deceive me? We can't name names? Paul named names, as did John (3 John 1:9), they warned us about false teachers BY NAME:
"2 Timothy 2:15 Do your best to present yourself to God as one approved,[c] a worker who has no need to be ashamed, rightly handling the word of truth. 16 But avoid irreverent babble, for it will lead people into more and more ungodliness, 17 and their talk will spread like gangrene. Among them are Hymenaeus and Philetus, 18 who have swerved from the truth, saying that the resurrection has already happened. They are upsetting the faith of some. 19 But God's firm foundation stands, bearing this seal: “The Lord knows those who are his,” and, “Let everyone who names the name of the Lord depart from iniquity.”"
Talk spreading like gangrene, not a positive description when you think about how gangrene spreads and how destructive it is. False teaching is destructive and must be challenged. It cannot be simply reduced to a private matter.
False teachers can be challenged publicly and must be challenged publicly, Matthew 18 doesn't apply to them.