Viaticum, the last Sacrament of the Christian

When death is near, Viaticum is celebrated. Often referred to as the Last Rites. the Pastoral Care of the Dying includes Viaticum and commendation of the dying. It includes the sarament of Penance, the profession of faith, and the reception of communion.
When a person is actively dying, preferrably still able to receive communion, it is time to call a priest.

Words from the Catechism of the Catholic Church.

1523 A preparation for the final journey. If the sacrament of anointing of the sick is given to all who suffer from serious illness and infirmity, even more rightly is it given to those at the point of departing this life; so it is also called sacramentum exeuntium (the sacrament of those departing).139 The Anointing of the Sick completes our conformity to the death and Resurrection of Christ, just as Baptism began it. It completes the holy anointing that mark the whole Christian life: that of Baptism which sealed the new life in us, and that of Confirmation which strengthened us for the combat of this life. This last anointing fortifies the end of our earthly life like a solid rampart for the final struggles before entering the Father's house.140

1524 In addition to the Anointing of the Sick, the Church offers those who are about to leave this life the Eucharist as viaticum. Communion in the body and blood of Christ, received at this moment of "passing over" to the Father, has a particular significance and importance. It is the seed of eternal life and the power of resurrection, according to the words of the Lord: "He who eats my flesh and drinks my blood has eternal life, and I will raise him up at the last day."141 The sacrament of Christ once dead and now risen, the Eucharist is here the sacrament of passing over from death to life, from this world to the Father.142

1525 Thus, just as the sacraments of Baptism, Confirmation, and the Eucharist form a unity called "the sacraments of Christian initiation," so too it can be said that Penance, the Anointing of the Sick and the Eucharist as viaticum constitute at the end of Christian life "the sacraments that prepare for our heavenly homeland" or the sacraments that complete the earthly pilgrimage.