Righteousness is perfect love. Sin is anything that contradicts God. It is an offence and the opposite of righteousness.
God wants us to experience righteousness (perfect love, perfect goodness), and He wants to keep all sin away from us. Why? Because God is the embodiment of perfect love (righteousness), and because perfect love and imperfect love (sin) cannot coexist. In 2 Corinthians 6:14, God asks, "For what do righteousness and lawlessness share together, or what does light have in common with darkness?" The answer is nothing. They are complete opposites.
We tend to think of sin in terms of the 'big' stuff: murder, adultery, and hatred. In Matthew 5, Jesus tells us that sin actually goes much deeper. He says,
"You have heard it said, 'You shall not murder' ... but I tell you that anyone who is angry with a brother or sister will be subject to judgment."
"You have heard it said, 'You shall not commit adultery.' But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart."
"You have heard it said, 'Love your neighbour and hate your enemy.' But I tell you, love your enemy and pray for those who persecute you".
Jesus is explaining that our understanding of sin falls woefully short. He's saying that, yes, murder and adultery are sins, but so are holding a grudge (unforgiveness), lust, and hatred. Jesus is saying that sin is not the outward action, but the inner workings of our hearts.
This is the reality: the motives of our hearts separate us from God (perfect love). So how do we fix it? We don't. No matter how many 'good' deeds we do, they can never erase the 'bad' motives of our hearts (which we all have, from time to time). But here's the good news: God created us knowing that we would fall short - that we would never obtain righteousness on our own or in our own strength.
God never intended to leave us to our own devices; He promised to rescue us, to forgive our wrongdoings, and to remember our sins no more (Hebrews 8:12). God created us knowing and promising to make a way for us to co-exist with Him and experience perfect love. He fulfilled His promise by sending Himself (Jesus) to take the penalty for our wrongdoing. God's Word tell us, "God made Him (Jesus) who had no sin to be sin for us, so that in Him we might become the righteousness of God." 2 Corinthians 5:21.
Instead of relying on our own deeds, we rely on Jesus. We give control of our life to God. When we do, God imputes His own righteousness to us. It's simple but difficult to understand. God wants us to experience perfect love, but we are incapable. So, He does it for us. He says, 'Just know me - know that I am God and you are not."
It might not make sense to you right now. But if you're tired, burdened, and worn out, and you ask God to take over, He'll show you what this all means. He'll make all the wrongs right, change the workings of your heart, and you will experience perfect love.