“The Return of the Prodigal Son” by Rembrandt
“It’s not fair! How is it that those hypocritical Christians can believe that a person who spends their whole life in sin and repents just before death can be saved and a person who does good their whole life and leaves the Church cannot?”
This is a common argument made especially by religious skeptics. If they have issues with this, then take it to Christ Himself who mentioned the parable of the prodigal son and the other of the Pharisee and the tax collector. The prodigal son left his family for a long period of time and when he returned to his family, his father greeted him with open arms and celebrated his return with a feast and dressed him in the finest clothes and jewelry; the other son complained, telling his father, “I have been loyal to you my whole life and he left you until just now” and “How come he gets the big celebration and I do not”, to this Our Lord said, “I say to you, that even so there shall be joy in heaven upon one sinner that doth penance, more than upon ninety-nine just who need not penance” .
In the other parable the Pharisee says, “Thank God I am not like that greedy tax collector who rips off even the poor; I give alms and pray X amount of times a day” while the tax collector beat his chest saying, “Forgive me, Lord, for I am a sinner” . The critics of Christianity act like the Pharisee when they say, “I should be called a Christian because I give to the poor and I am nice to people” when pious Christians repent saying, “Forgive me, Lord, for I have sinned.” We say something similar to this in the Sacrament of Confession: “Forgive me, Father, for I have sinned.” This is actually a quote from the prodigal son parable. We see how Our Lord said, “Receive the Holy Spirit; whose sins you forgive are forgiven and whose sins you retain are retained” ; we see that only a select few were given this power as not all the seventy disciples were present when this occurred and Sacred Tradition upheld this teaching as referring to the ministerial priesthood; only the apostles, bishops and priests of the Church received this charisma of the Holy Spirit, with which they had to authority to forgive sins in Christ’s name just as they had the authority to expel demons, heal the sick and cure in the blind in His name . In this “ministry of reconciliation”  as Saint Paul called it, we are forgiven of our sins as he said, “[I]f I have pardoned any thing, for your sakes have I done it in the person of Christ” .
Of course, in confessing our sins, we must do penance. Repeatedly we hear God in Scripture demanding justice for sins committed. We do not get off that easily, and to undo the wrongs we have done we are commanded to do penance as the Israelites had to make restitution for crimes they committed. Saint John the Baptist exhorted, “Bring forth therefore fruits worthy of penance” . If the person does not do penance for his/her sins after a confession just before death, it is possible they may have to undergo additional purification in the afterlife to make up for the lack of penance in one’s earthly life; over the centuries the Church had to explain it was possible for a late penitent to make it to Heaven; the Church sees how Scripture says God purifies them like “gold in the furnace” , or that one may not leave this spiritual prison until they have paid the last penny .
We live by God’s standards, not ours; thus we do not distort Scripture nor Tradition when we say a penitent even at death may receive forgiveness. It’s God’s forgiveness to give, not ours; we cannot withhold His forgiveness from anybody, and strangely the complaints come from people who moan and groan about giving people second chances. We are not saved merely by our works, that we may boast . It is by the grace of God , which helps us grow in faith, hope and charity, which is found namely in the Sacraments which are visible signs of God’s invisible graces. This standard works both for bad Christians who repent late in life and for bad non-Christians who repent late in life. If somebody gets mad that they are not Christians and a bad Christian is called a Christian, then I have to wonder why these people do the works they do. We must not boast of our works.
 Luke 15:7.11-32
 Luke 18:11-15
 John 20:23
 Mark 6:12-13, James 5:14-15
 2 Corinthians 5:18
 2 Corinthians 2:10
 Luke 3:8
 Wisdom 3:6
 Matthew 5:26
 Ephesians 2:9
 Ephesians 2:8