Abu Hurairah reported,

The Messenger of Allah ﷺ prayed over a funeral and said, "Allah, forgive our living and our dead, our young and our old, our males and our females, those of us present and those absent. Allah, whoever among us You keep alive, let him live in faith, and whoever among us You take in death, let him die in Islam. Allah, do not deprive us of his reward, and do not lead us astray after him."

Azami 11104

Sahih

عن أبي هريرة قال

صلى رسول الله ﷺ على جنازة فقال: اللهم اغفر لحينا وميتنا، وصغيرنا وكبيرنا، وذكرنا وأنثانا، وشاهدنا وغائبنا، اللهم من أحييته منا فأحيه على الإيمان، ومن توفيته منا فتوفه على الإسلام، اللهم لا تحرمنا أجره، ولا تضلنا بعده.

الأعظمي 11104صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Supplications for illness and funerals, and what relates to them
Section
Supplication for the deceased in the funeral prayer
Numbering
Jami al-Kamil 11104 (2nd edition)
Azami 11104