Praise be to Allah.
In al-Sahihayn, Ibn 'Abbas narrated that the Messenger of Allah (peace and blessings of Allah be upon him) used to say, when he felt distressed :
“La ilaha ill-Allah al-‘Azim ul-Halim, La ilaha ill-Allah Rabb il-‘arsh il-‘azim, La ilaha ill-Allah Rabbis-samawati wa Rabbil-ard wa Rabbil-‘arsh il-karim (there is no god except Allah, the All-Mighty, the Forbearing; there is no god except Allah, the Lord of the Mighty Throne; there is no god except Allah, Lord of the heavens, Lord of the earth and Lord of the noble Throne).”
Anas (may Allah be pleased with him) narrated that the Prophet (peace and blessings of Allah be upon him) used to say, when something upset him:
“Ya Hayyu ya Qayyum, bi Rahmatika astaghith (O Ever-Living One, O Everlasting One, by Your mercy I seek help).”
Asma bint ‘Umays (may Allah be pleased with her) said: The Messenger of Allah (peace and blessings of Allah be upon him) said to me: “Shall I not teach you some words to say when you feel distressed? ‘Allah, Allah, Rabbi la ushriku bihi shay-an (Allah, Allah, my Lord, I do not associate anything with Him).’”
‘Abd-Allah ibn Mas’ud narrated that the Prophet (peace and blessings of Allah be upon him) said: “No person suffers any anxiety or grief , and says:
‘Allahumma inni ‘abduka wa ibn ‘abdika wa ibn amatika, nasiyati bi yadika, madin fiyya hukmuka, ‘adlun fiyya qadauka, as aluka bi kulli ismin huwa laka sammayta bihi nafsaka aw anzaltahu fi kitabika aw ‘allamtahu ahadan min khalqika aw ista’tharta bihi fi ‘ilm il-ghaybi ‘indak an taj’ala al-Qurana rabi’a qalbi wa nura sadri wa jala a huzni wa dhahaba hammi (O Allah, I am Your slave, son of Your slave, son of Your female slave, my forelock is in Your hand, Your command over me is forever executed and Your decree over me is just. I ask You by every Name belonging to You which You named Yourself with, or revealed in Your Book, or You taught to any of Your creation, or You have preserved in the knowledge of the unseen with You, that You make the Quran the life of my heart and the light of my breast, and a departure for my sorrow and a release for my anxiety)’ - but Allah will take away his sorrow and grief , and give him in their stead joy.”
And Allah knows best.