The best dua to wish for death in case of dire situations
BUKHARI 6351:
from Anas —
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, 'O Allah! Let me live as long as life is better for me, and take my life if death is better for me.'"
البخاري ٦٣٥١:
عن انس —
قَالَ رَسُولُ اللَّهِ ﷺ: «لاَ يَتَمَنَّيَنَّ أَحَدٌ مِنْكُمُ الْمَوْتَ لِضُرٍّ نَزَلَ بِهِ۔ فَإِنْ كَانَ لاَ بُدَّ مُتَمَنِّيًا لِلْمَوْتِ فَلْيَقُلِ: (اللَّهُمَّ أَحْيِنِي مَا كَانَتِ الْحَيَاةُ خَيْرًا لِي وَتَوَفَّنِي إِذَا كَانَتِ الْوَفَاةُ خَيْرًا لِي۔)»