Hadithcore
Mishkat al-Masabih, 2417

He told that God’s messenger used to say when he was anxious “There is no god but God, the Incomparably Great, the Clement; there is no god but God, the Lord of the mighty Throne; there is no god but God, the Lord of the heavens, the Lord of the earth, and the Lord of the noble Throne.” (Bukhari and Muslim.)

وَعَنْهُ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ كَانَ يَقُولُ عِنْدَ الْكَرْبِ: «لَا إِلَهَ إِلَّا اللَّهُ الْعَظِيمُ الْحَلِيمُ لَا إِلَهَ إِلَّا اللَّهُ رَبُّ الْعَرْشِ الْعَظِيمِ لَا إِلَهَ إِلَّا اللَّهُ رَبُّ السَّمَاوَاتِ وَرَبُّ الْأَرْضِ رَبُّ الْعَرْشِ الْكَرِيم»

References1 variant
In-Book Reference
Book 9, Hadith 187