The Bible has no examples of anyone praying for the dead. This is not a biblical practice.
Firstly because the dead are dead. They no longer exist. Their names hopefully are recorded in the ‘book of life’ to be opened when Christ returns to raise the dead, but nothing can be done to alter their fate at this point. Paul is explicit on this in 1 Thessalonians 4 where he compares those who sleep in Christ with those who die outside Christ and “have no hope” – it is too late to pray for them:
But we do not want you to be uninformed, brothers, about those who are asleep, that you may not grieve as others do who have no hope. (1 Thessalonians 4:13)
Secondly because it is Christ’s prerogative to judge people at the resurrection according to their own behaviour while alive, not according to the prayers of others. The writer to the Hebrews says very clearly:
“Just as man is destined to die once, and after that to face judgment” (Hebrews 9:27).
Here we understand that judgment is based on what happens before death. Although we need to make one caveat to that statement in Hebrews 9:27. That statement is made in a letter to Christians and the context is believers. It is no inconsistent with Old Testament statements about non-believers, such as Isaiah 26:14 that pagan nations will not be resurrected but simply die and be gone for ever.
Pray for All Living People
So the conclusion of this question is simple and serious. The time to pray for people is when they are alive. This is what the New Testament teaches, to pray for others while they are alive. That they may be converted, and then live a new life in Christ.
2 First of all, then, I urge that supplications, prayers, intercessions, and thanksgivings be made for all people, 2 for kings and all who are in high positions, that we may lead a peaceful and quiet life, godly and dignified in every way. 3 This is good, and it is pleasing in the sight of God our Saviour, 4 who desires all people to be saved and to come to the knowledge of the truth. 5 For there is one God, and there is one mediator between God and men, the man Christ Jesus, 6 who gave himself as a ransom for all, which is the testimony given at the proper time. 7 For this I was appointed a preacher and an apostle (I am telling the truth, I am not lying), a teacher of the Gentiles in faith and truth. (1 Timothy 2:2-6 ESV)
Note particularly verse 4 “[God] who desires all people to be saved and to come to the knowledge of the truth.” This reminds us of Paul’s advice “How will they hear without a preacher?” (Romans 10:14). Prayer for others is essential. But it should be backed up by helping those who do not yet know Christ to hear. And likewise by encouraging and strengthening those who are already in Christ (1 Thessalonians 5:11 etc.).
Practical help for the bereaved
Particularly in the context of funerals we also of course should pray for the families of those who have fallen asleep. But not just pray, also comfort and help them spiritually and practically.
Rejoice with those who rejoice; mourn with those who mourn. (Romans 12:15)
The righteous man perishes, and no one lays it to heart; devout men are taken away, while no one understands. For the righteous man is taken away from calamity; (Isaiah 57:1)
Religion that is pure and undefiled before God the Father is this: to visit orphans and widows in their affliction, and to keep oneself unstained from the world. (James 1:27)