The Messenger of Allah ﷺ taught me that when distress befalls me, I should say, "There is no god but Allah, the Forbearing, the Generous. Glory be to Allah, and blessed is Allah, Lord of the mighty Throne. All praise belongs to Allah, Lord of the worlds."
حدثنا روح حدثنا أسامة بن زيد عن محمد بن كعب القرظي عن عبد الله بن شداد بن الهاد عن عبد الله بن جعفر
علمني رسول الله ﷺ إذا نزل بي كرب أن أقول لا إله إلا الله الحليم الكريم سبحان الله وتبارك الله رب العرش العظيم والحمد لله رب العالمين
Its isnad is sahih. See 712, 726, 1363. Hakim also related it, 1/508, by way of Rawh from Usama, then by way of Saeed bin Mansur from Yaqub bin Abdul-Rahman from Muhammad bin Ajlan from Muhammad bin Kaab, adding at the end, "Abdullah bin Jafar used to teach it to the dying, and he would blow it upon those suffering from fever." Hakim declared it sahih according to the standard of Muslim, and Dhahabi agreed with him.It will also come again from the hadith of Abdullah bin Jafar at 1762, and from the hadith of Ibn Abbas at 2012. See also 726, 1363.