Beware of practicing your righteousness before other people in order to be seen by them, for then you will have no reward from your Father who is in heaven.
If we are living lives empowered by the Holy Spirit, showing signs of the counter-cultural attitudes that Jesus describes, then it is inevitable that people will see and notice. Jesus' warning here is that about behaving "righteously" in front of people in order to be seen by them. Are we turning the other cheek out of love and mercy or because it will impress someone else? Are we going the extra mile as a response to the grace God has shown us or because we think that's what we should do? Are we really serving ourselves when it appears that we are serving God and others? The actions may be exactly the same in both cases but God sees our motivation. It is possible to resist God's grace by disobeying him but it is also possible to resist God's grace by following the rules and relying on our own performance.
There is no reward from God for self-serving service. He is not impressed by token generosity or superficial love. He looks at the heart, and shows mercy to those who recognise they need it. His mercy sets us free to serve him without thinking about what we can get out of it.