The short answer is that prayer can help shorten the time someone spends in Purgatory, but, as was pointed out, funerals predated Christianity so it would be incorrect to state that funerals will help shorten the time, in part, because funerals are a way for those that survive to reflect on and to have closure over the loss of a loved one.
In the Catechism of the Catholic Church you find this:
1032 This teaching is also based on the practice of prayer for the
dead, already mentioned in Sacred Scripture: "Therefore [Judas
Maccabeus] made atonement for the dead, that they might be delivered
from their sin."609 From the beginning the Church has honored the
memory of the dead and offered prayers in suffrage for them, above all
the Eucharistic sacrifice, so that, thus purified, they may attain the
beatific vision of God.610 The Church also commends almsgiving,
indulgences, and works of penance undertaken on behalf of the dead:
Let us help and commemorate them. If Job's sons were purified by their
father's sacrifice, why would we doubt that our offerings for the dead
bring them some consolation? Let us not hesitate to help those who
have died and to offer our prayers for them.611
Scripturally you can look at 2 Maccabees 12, and you may want to read some part of the last section of this chapter for context, but at verse 46 is this:
46 It is therefore a holy and wholesome thought to pray for the dead,
that they may be loosed from sins.
We also have Job 1:5
5 When a period of feasting had run its course, Job would make
arrangements for them to be purified. Early in the morning he would
sacrifice a burnt offering for each of them, thinking, “Perhaps my
children have sinned and cursed God in their hearts.” This was Job’s
In the RCC those that have died before us are still part of our church, and much as Job made sacrifices to help purify his children, and much as prayers for the dead help them, we continue this tradition to help shorten the time people spend in Purgatory, as you cannot enter the gates of Heaven with any stain on your soul, so if you did not die perfectly in grace, you spend time being purified, then enter Heaven.
Now, this is different than worshiping the dead. Not all prayer is worship, prayer can also just be a way to talk with someone that you care about that isn't with you, for example. True worship should only be for God. This is often a point of confusion for non-catholics.
For more on this you can look at:
And for some quotes from early church fathers, and more explanation you can look at:
For those that want to argue about the validity of 2 Maccabees you may want to read this first to see what the early church fathers taught about the OT canon, for example that it was quoted by Cyprian of Carthage.