In Catholicism, the last rites, also known as the Commendation of the Dying, are the last prayers and ministrations given to an individual of the faith, when possible, shortly before death. They may be administered to those awaiting execution, mortally injured, or terminally ill. Last rites cannot be performed on someone who has already died. Last rites, in sacramental Christianity, can refer to multiple sacraments administered concurrently in anticipation of an individual's passing.
The Latin Church of the Catholic Church defines Last Rites as Viaticum (Holy Communion administered to someone who is dying), and the ritual prayers of Commendation of the Dying, and Prayers for the Dead.
The sacrament of Anointing of the Sick is usually postponed until someone is near death. Anointing of the Sick has been thought to be exclusively for the dying, though it can be received at any time. Extreme Unction (Final Anointing) is the name given to Anointing of the Sick when received during last rites. If administered to someone who is not just ill but near death, Anointing of the Sick is generally accompanied by celebration of the sacraments of Penance and Viaticum. The order of the three is important and should be given in the order of Penance (confessing one's sins), then Anointing of the Sick, and finally the Viaticum.  The principal reason Penance is administered first to the seriously ill and dying is because the forgiveness of one's sins, and most especially one's serious (mortal) sins, is for Catholics necessary for being in a state of grace (not guilty of serious sin and so in a full relationship with God). Dying while in the state of grace ensures that a Catholic will eventually make it to heaven, after going through a spiritual cleansing process called purgatory.
Although these three (Penance, Anointing of the sick, and Viaticum) are not, in the proper sense, the Last Rites, they are sometimes mistakenly spoken of as such.
The Eucharist given as Viaticum is the only sacrament essentially associated with dying: "The celebration of the Eucharist as Viaticum is the sacrament proper to the dying Christian".
In the Roman Ritual's Pastoral Care of the Sick: Rites of Anointing and Viaticum, Viaticum is the only sacrament dealt with in Part II: Pastoral Care of the Dying. Within that part, the chapter on Viaticum is followed by two more chapters, one on Commendation of the Dying, with short texts, mainly from the Bible, a special form of the litany of the saints, and other prayers, and the other on Prayers for the Dead. A final chapter provides Rites for Exceptional Circumstances, namely, the Continuous Rite of Penance, Anointing, and Viaticum, Rite for Emergencies, and Christian Initiation for the Dying. The last of these concerns the administration of the sacraments of Baptism and Confirmation to those who have not received them.
In addition, the priest has authority to bestow a blessing in the name of the Pope on the dying person, to which a plenary indulgence is attached.
In the Eastern Orthodox Church and those Eastern Catholic Churches which follow the Byzantine Rite, the last rites consist of the Sacred Mysteries (sacraments) of Confession and the reception of Holy Communion.
Following these sacraments, when a person dies, there are a series of prayers known as The Office at the Parting of the Soul From the Body. This consists of a blessing by the priest, the usual beginning, and after the Lord's Prayer, Psalm 50. Then a Canon to the Theotokos is chanted, entitled, "On behalf of a man whose soul is departing, and who cannot speak". This is an elongated prayer speaking in the person of the one who is dying, asking for forgiveness of sin, the mercy of God, and the intercession of the saints. The rite is concluded by three prayers said by the priest, the last one being said "at the departure of the soul."
There is an alternative rite known as The Office at the Parting of the Soul from the Body When a Man has Suffered for a Long Time. The outline of this rite is the same as above, except that Psalm 70 and Psalm 143 precede Psalm 50, and the words of the canon and the prayers are different.
The rubric in the Book of Needs (priest's service book) states, "With respect to the Services said at the parting of the soul, we note that if time does not permit to read the whole Canon, then customarily just one of the prayers, found at the end of the Canon, is read by the Priest at the moment of the parting of the soul from the body."
As soon as the person has died the priest begins The Office After the Departure of the Soul From the Body (also known as The First Pannikhida).
In the Orthodox Church Holy Unction is not considered to be solely a part of a person's preparation for death, but is administered to any Orthodox Christian who is ill, physically or spiritually, to ask for God's mercy and forgiveness of sin. There is an abbreviated form of Holy Unction to be performed for a person in imminent danger of death, which does not replace the full rite in other cases.
Main article: Lutheran sacraments § Anointing of the Sick
In the Lutheran Churches, last rites are formally known as the Commendation of the Dying, in which the priest "opens in the name of the triune God, includes a prayer, a reading from one of the psalms, a litany of prayer for the one who is dying, [and] recites the Lord’s Prayer". The dying individual is then anointed with oil and receives the sacraments of Holy Absolution and Holy Communion.
Main article: Anointing of the sick § Anglican churches
The proposed 1928 revision of the Church of England's Book of Common Prayer would have permitted reservation of the Blessed Sacrament for use in communing the sick, including during last rites. This revision failed twice in the Parliament of the United Kingdom's House of Commons.
The priest was correct: only a living person can receive a sacrament, including the sacrament of the sick.