Can a person ever deserve to spend eternity in heaven or hell?
Consider the idea that "the punishment should fit the crime." Things like a lifetime in prison for stealing bubblegum or a fine of five dollars for murder are both thought to be wrong because their punishments are not proportionate to the crimes being committed.
So it can be wrong to both under-punish and over-punish a person for a crime.
Perhaps a simple way to think of what would be a fair reward or punishment is in terms of pain and pleasure. If your immoral act causes x amount of pain, you deserve to be punished in a way where you'll receive x amount of pain. If your moral act causes y amount of pleasure, you deserved to be rewarded with y amount of pleasure.
Now it seems that actions can either cause a finite or an infinite amount of pain and pleasure.
If actions can cause a finite amount of pain and pleasure, then it means in our lifetimes we will only ever cause a finite amount of pain and pleasure. The problem with this is that if we cause a finite amount of pain and are punished with an infinite amount of pain, which is what hell would appear to do, then spending an eternity in hell is not a fair punishment because it will punish a person too harshly. Further, if we cause a finite amount of pleasure and are rewarded with an infinite amount of pleasure, which is what heaven would appear to do, then we would be overly-rewarded for our actions. Therefore, in this case, whether we go to heaven or hell, we will not be getting what we deserve.
But what about the second option? Can our actions cause an infinite amount of pain and pleasure?
First, I should say that I don't think it's like that are actions cause an infinite amount of pain or pleasure, at least in any reasonable sense. Take an act like murder, which is arguably the worst action a person can commit. Let's say I kill a person who is 20 years old. Let's be generous and say my victim would have lived to be 100 years old if I had not killed him. So I've taken away 80 years of his life, along with the pain of the murder itself. Perhaps it would be reasonable for me to be tortured in hell for every year I took away from my victim, plus a few extra years for the pain caused in the murder. But even if I try to go with a more extreme punishment, say one million years of the worst torture hell has to offer for every year of life I took away from my victim, this would still only lead to a fair punishment being 80 million years in hell, and punishing me with an eternity in hell when I deserve 80 million years in hell would not be just.
Second, even if our actions can cause an infinite amount of pain or pleasure, this could cause it's own problems. For example, what if I do one act that causes an infinite amount of pain, but then I do an act that causes an infinite amount of pleasure? Do I receive an afterlife where I experience both an infinite amount of pain and an infinite amount of pleasure? Do they cancel each other out? Perhaps these aren't huge problem and if it is the case that our actions can cause an infinite amount of pain and pleasure, this would solve the problem of deserving heaven or hell, but again, I do not think it's reasonable to think our actions cause an infinite amount of pain and pleasure.
Perhaps there is another sense of desert that can show how a person could deserve heaven or hell. For example, if I tell you that if you do x then y will happen, then you go ahead and do x anyway, it could be argued that you deserve y.
Imagine I'm talking to Jesus and I tell him that my room is being fumigated and if he goes in there, he's gonna become sick. Jesus responds, "Whatever" and goes into the room anyway and ends up getting sick. Jesus has never done anything wrong, but because I told him he'd get sick if he went into my room and he did it anyone, perhaps it's right to say that he deserved to get sick.
Maybe it is in this sense that a person can deserve to go to heaven or hell. Perhaps God could say, "Look, I told you all that if you do good things, you'll go to heaven for eternity. If you do bad things, you'll go to hell for eternity. If knowing that you still went and did bad things anyway, you deserve to go to hell. It's as simple as that."
This of course has its own problems, such as people who haven't been told that they will go to heaven or hell for eternity based on their actions and whether or not this is really "desert" and not something else, but maybe it can help solve this conflict between desert, heaven, and hell.
... But probably not.