We worship a God who gives the full-lifetime rewards even to the one-hour laborers. He is not a God who makes us fallible human creatures, gives us an impossible list of things to do and an immeasurably high standard to reach, and then punishes us when we fail to measure up. What kind of a God is that? If we work on our weaknesses—and we have our Savior’s help in this—we are promised the recompense given those who have lived a complete life of goodness. That is comforting. That is encouraging.
S. Michael Wilcox, "What Seek Ye?", Deseret Book 2020
It may seem unfair those who live their entire lives trying to be good, only to get the same recompense as those who only try to be good at the end. I'll be honest, I have struggled with this in the past. Why should the prodigal son get the best that the father has after living riotously and frivolously when I've (rhetorically) lived righteously my entire life?

Here are some thoughts I have on this:
1. See it from an eternal perspective, the reward is just being planted firmly on the covenant path. That may be halfway down it, or snack dab at the beginning. Our Father wants ALL of His children back. He is ecstatic whenever we come back and get on the path no matter where, and weeps when we choose not to walk it at all.
2. The character or spiritual quality of the person who tried their entire lives to be good is more mature than those just straightening up at the end. They are further down the path to perfection, so they should get there quicker (theoretically). They have more spiritual equity built up.
3. Perception is always one-sided. We don't know the situation or circumstances of others. We just don't have the entire picture. God does. Maybe it just "appears" to us that someone has turned their life around at the end, but, in reality, they've been trying to do so their entire lives and haven't been successful yet. Besides, we are commanded to love our neighbor so we should also be ecstatic when they turn their lives around no matter when that is.
4. Salvation is individual. It shouldn't matter what other people get or don't get. That's between them and Heavenly Father. Our focus should be where our own feet are planted. We need to work on removing the beam from our own eye.