Ali (RA) narrates, “The Prophet (S) taught me that when I’m struck by grief or sadness I should say,
لا إِلَهَ إِلا اللَّهُ الْحَلِيمُ الْكَرِيمُ سُبْحَانَ اللَّهِ وَتَبَارَكَ اللَّهُ رَبُّ الْعَرْشِ الْعَظِيمِ وَالْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ
lā ʼilāha ʼillallāhul ḥalīmul karīmu subḥānallāhi, wa tabārakallāhu rabbul ʻaršil ʻaẓīmi wal-ḥamdu lillāhi rabbil ʻālamīna
There is no god but Allah, the Most-Gentle, the Most-Noble. Glory is for Allah! Allah is blessed, the Master of the great throne. All praise is for Allah, the Lord of the worlds.”
One thing to note is how much the Prophet (S) cared for the sahaba in every way. Even in their personal ups-and-downs, the Prophet (S) wanted to make sure that they had the guidance needed to make it through. Truly a mercy for all of mankind, peace be upon him!