Right after saying "Let your good works shine before men" (Matthew 5:16), #yeshua said "Beware of practicing your righteousness before other people" (Matthew 6:1). What did he mean?

The difference is in motivation. Your obedience with a right heart allows God's light to shine through you. Do good works openly in humble obedience to God's commandments. Wear your tzitziyot so they can be seen, but don't be proud of them. Don't advertise your charity towards the poor, but you don't have to treat it like national security secret, either. This will display God's righteousness, not yours. Focus attention on God, not yourself.