Earlier in chapter 18, Jesus is talking about the joy of recovering those who stray from the flock. Now, he's talking about the difficulty of living with those who don't leave. "Here's what you can expect: some church members are going to treat you badly. Don't ignore the problem. Even if you are not at fault, you still have the responsibility to mend the relationship."
Here's the hard part. Start by going directly to the offender. Don't go around telling everybody else how much you are hurt. First, tell the one who hurt you.
Then, if that doesn't work, and only if that doesn't work, share your concerns with a couple of other church members. If that doesn't work, and only if that doesn't work, then you may tell others in the church about the problem.
If the offender won't listen to the whole church, then treat that person like a Gentile and a tax collector.
Notice the irony in this last instruction by remembering how Jesus treated Gentiles and tax collectors.