I guess the answer to this question is kind of obvious, but do we need to repent for things that we did a long time ago? (Perhaps a few years, or decades) And if so, how would I repent for such a thing because some things are so far back in the past that it doesn’t seem to affect or make me feel deep sorrow over it?
I’m wondering what your understanding of repentance is. At its core, repentance means change. So if you have changed and are no longer doing whatever it is you did years and years ago, for the most part, you probably have repented. Obviously that might not count if you didn’t have a full change. In other words, if you just stopped doing whatever it was because of fortune or the situation you’re in but didn’t have a change of heart. Has your heart changed?
Also, how do we know if someone has repented (including ourselves)? We will confess and forsake them. (D&C 58:43) You’ve forsaken them. Have you confessed them? If they are serious, then you need to confess to proper priesthood authority. That remains true even if they were years and years and years ago. If they are less serious, you need to confess them to God. Get on your knees, confess them, and ask for His forgiveness.
Don’t forget about reparation. If you have wronged someone, you still need to try and make it right as best you can, even years later. If you hurt someone in some way, at the very least, you can still apologize in sincerity. And if there are other ways to fix the issue, do it.
The time away from the sin does count — absolutely. But repentance, as I said, is about change — fixing the wrong and changing our hearts through the atonement. So the time away from the sin is helpful. It is good. Continue on the path away from it. If, however, you have not also made the other efforts to truly change the wrong, and change yourself through confession and reparation, then go to it.