Hadithcore
Mishkat al-Masabih, 2452

Ibn Mas'ud reported God’s messenger as saying that if anyone is afflicted by much care he should say, “O God, I am Your servant, the son of Your servant, the son of Your handmaid, and at Your disposal; my forelock is in Your hand; Your judgment is effective regarding me; just concerning me is Your decree; I ask You by every name You have by which You have called Thyself, or sent down in Your Book, or taught any of Your creatures, or kept to Thyself in the hidden place of the unseen, to make the Qur’an the Spring of my heart and the means of clearing away my care and grief.” He declared that no one had ever said it without God removing his grief and giving him joy instead of it. Razin transmitted it.

وَعَنِ ابْنِ مَسْعُودٍ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ:

مَنْ كَثُرَ هَمُّهُ فَلْيَقُلْ: اللَّهُمَّ إِنِّي عَبْدُكَ وَابْنُ عَبْدِكَ وَابْنُ أَمَتِكَ وَفِي قَبْضَتِكَ نَاصِيَتِي بِيَدِكَ مَاضٍ فِيَّ حُكْمُكَ عَدْلٌ فِيَّ قَضَاؤُكَ أَسْأَلُكَ بِكُلِّ اسْمٍ هُوَ لَكَ سَمَّيْتَ بِهِ نَفْسَكَ أَوْ أَنْزَلْتَهُ فِي كِتَابِكَ أَوْ عَلَّمْتَهُ أَحَدًا مِنْ خَلْقِكَ أَوْ أَلْهَمْتَ عِبَادَكَ أَوِ اسْتَأْثَرْتَ بِهِ فِي مَكْنُونِ الْغَيْبِ عِنْدَكَ أَنْ تَجْعَلَ الْقُرْآنَ رَبِيعَ قلبِي وجِلاء هَمِّي وغَمِّي مَا قَالَهَا عَبْدٌ قَطُّ إِلَّا أَذْهَبَ اللَّهُ غمه وأبدله فرجا

. رَوَاهُ رزين

References1 variant
In-Book Reference
Book 9, Hadith 221