Abdullah bin Abbas reported,

The Messenger of Allah ﷺ used to supplicate with these words and say them in times of distress. He then mentioned the same as the hadith of Muaz bin Hisham from his father from Qatada, except that he said, "Lord of the heavens and the earth."

Muslim 6923

Sahih

و حدثنا عبد بن حميد أخبرنا محمد بن بشر العبدي حدثنا سعيد بن أبي عروبة عن قتادة أن أبا العالية الرياحي حدثهم

عن ابن عباس

أن رسول الله ﷺ كان يدعو بهن ويقولهن عند الكرب فذكر بمثل حديث معاذ بن هشام عن أبيه عن قتادة غير أنه قال رب السماوات والأرض

مسلم 6923صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Remembrance, supplication, Tawba, and seeking forgiveness
Chapter
Supplication for distress
Numbering
Darussalam 6923
Muslim 6923