Is this salvation by works? Does this teach that we earn our way to heaven? No. Salvation is by grace through faith (Ephesians 2:8). And the opposite of salvation, judgment, is not by grace through faith, but by works (the opposite of grace) through unbelief (the opposite of faith). So that’s what Jesus means.
Therefore when Jesus teaches that an unforgiving spirit or bitterness leads to judgment and not to salvation, he means that bitterness is a kind of unbelief. And the way to fight against it is to fight the fight of faith. The battle against bitterness in our hearts is not an effort to work our way to heaven. It’s a battle to believe the Word of God, and bank on the promises of his grace.
Back during my seminary days Noël and I were in a kind of 20:20 group with some other couples. One night we were discussing forgiveness and anger, and one of the women said that she could not and would not forgive her mother for something she had done to her as a young girl. We talked about some of the biblical commands to forgive, and we talked about being forgiven by God, but she was adamant.
So I said, “You know, don’t you, that you are in mortal danger of being cast into hell? If you’re not willing to forgive your mother her sins against you, God will not be willing to forgive your sins against him. No unforgiving people will be in heaven.” But she wasn’t the kind of person who submitted easily to Scripture. She was driven by emotion and the strength of her indignation simply justified itself.
The reason she was in danger of losing her soul is not because she didn’t work hard enough for God, but because she didn’t trust in his willingness to work hard enough for her.
The battle against bitterness is a battle against unbelief. And the peace and rest and joy that come in place of anger and bitterness are the peace and joy that Romans 15:13 says explicitly come by believing in the God of hope.