The best dua to wish for death in case of dire situations

BUKHARI 6351: from Anas —

The Messenger of Allah ﷺ said, "None of you should long for death because of a calamity that had befallen him. But if he must long for death, then he should say:

allāhumma aḥyinī mā kānat al-ḥayātu khayran lī, wa-tawaffanī idhā kānat al-wafātu khayran lī

O Allah! Let me live as long as life is better for me, and take my life if death is better for me."

البخاري ٦٣٥١: عن انس —

قَالَ رَسُولُ اللَّهِ ﷺ: «لاَ يَتَمَنَّيَنَّ أَحَدٌ مِنْكُمُ الْمَوْتَ لِضُرٍّ نَزَلَ بِهِ۔ فَإِنْ كَانَ لاَ بُدَّ مُتَمَنِّيًا لِلْمَوْتِ فَلْيَقُلِ: 

(اللَّهُمَّ أَحْيِنِي مَا كَانَتِ الْحَيَاةُ خَيْرًا لِي وَتَوَفَّنِي إِذَا كَانَتِ الْوَفَاةُ خَيْرًا لِي)».


Agreed Upon (Luʿluʿ wa-al-Marjān)
Bukhārī > Invocations > § The invocation for death or life
hadithunlocked.com