Righteousness is perfect love (God). Sin is anything that contradicts God.
We tend to think of sin in terms of the 'big' stuff: murder, adultery, etc., but Jesus tells us that sin actually goes much deeper. In Matthew 5, 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.
The Bible tells us that sin and righteousness cannot coexist: "For what do righteousness and lawlessness share together, or what does light have in common with darkness?" (2 Corinthians 6:14). Righteousness and sin are complete opposites.
God is righteous, and we, because of the wrong motives we all have from time to time, are unrighteous (lawless/darkness). We are therefore all separated from God; we can't coexist with Him.
So how do we fix it? We don't. We can't.
God created us knowing that we would fall short in this way; that we would never obtain righteousness on our own. But God never intended to leave us in our unrighteousness. He promised (the "New Testament") to rescue us, to forgive our wrongdoings, and to remember our sins no more (Hebrews 8:12).
God 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 Him control of our life, and when we do, God imputes His own righteousness to us.
It's simple yet difficult to understand. God wants us to experience righteousness and to coexist with Him for eternity (to experience perfect love). We are incapable of obtaining righteousness on our own because we all have motives that fall short from time to time. So God does it for us. He wants us to know Him; to know that He is God and we are not.
It might not all 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 inner workings of your heart, and you will experience perfect love.