Show good works
(Matthew 5:16) – “Let your light shine before men in such a way that they may see your good works, and glorify your Father who is in heaven.”
(1 Peter 2:12) – “Keep your behavior excellent among the Gentiles, so that in the thing in which they slander you as evildoers, they may because of your good deeds, as they observe them, glorify God in the day of visitation.”
Don’t show good works
Matthew 6:1-4) – “Beware of practicing your righteousness before men to be noticed by them; otherwise you have no reward with your Father who is in heaven. 2So when you give to the poor, do not sound a trumpet before you, as the hypocrites do in the synagogues and in the streets, so that they may be honored by men. Truly I say to you, they have their reward in full. 3″But when you give to the poor, do not let your left hand know what your right hand is doing, 4so that your giving will be in secret; and your Father who sees what is done in secret will reward you.”
(Matthew 23:3,5) – “therefore all that they tell you, do and observe, but do not do according to their deeds; for they say things and do not do them…But they do all their deeds to be noticed by men; for they broaden their phylacteries and lengthen the tassels of their garments.”
As with any piece of literature, to best understand its statements you must read them in context. The Bible is no different. Matthew 5:16 is in the context of the beatitudes
(Matt. 5:1 – 7:29) where Jesus is teaching proper, good, and moral behavior. Disciples of Jesus are to be lights; that is, doers of good. 1 Peter 2:12 is where Peter is admonishing the Christians to live godly and holy lives before the unbelievers. We Christians live in the world among unbelievers and they are going to see how we live. Peter is telling us to act properly with unbelievers so that false accusations will not stand against us because we have lived with integrity among them.
By contrast, Jesus in Matthew 6:1-4, which is still in the same beatitudes where He told people to let their light shine before people (5:16) is stating that if the motive of doing something good is to be noticed by people, then don’t do that. Don’t boast about how “good” you are before people. That is wrong. There is nothing wrong with doing good works that will be seen before people, after all, we live among unbelievers. However, when you do good things, don’t do them for the purpose of drawing attention to how “good” you are.
Likewise in Matthew 23:3, 5 Jesus is addressing the crowds and teaching them about the hypocrisy of the Scribes and Pharisees and how they do their deeds in order to be noticed and admired. Jesus condemned this as is right.
People are supposed to notice your good works because your good character permeates them, not because of your attempt to have them see how “good” and “great” you are. The former is humility. The latter is prideful and wrong. The context of each verse tells us this.
“All therefore whatsoever they bid you observe, that observe and do; but do not ye after their works: for they say, and do not. 5 But all their works they do for to be seen of men: they make broad their phylacteries, and enlarge the borders of their garments,” (Matt 23:3.5)