Quran 12:56~57

This is how We established Yusuf (Joseph) in the land to settle wherever he pleased. We shower Our mercy on whoever We will, and We never discount the reward of the good-doers.And the reward of the Hereafter is far better for those who are faithful and are mindful ˹of Allah˺.
Yusuf (Arabic: يوسف, Yūsuf; Arabic synonym of “Joseph”) is the 12th chapter (Surah) of the Quran and has 111 Ayahs (verses)
click the button above to listen to the recitation of these Quranic verses again
وَكَذَلِكَ مَكَّنَّا لِيُوسُفَ فِى ٱلْأَرْضِ يَتَبَوَّأُ مِنْهَا حَيْثُ يَشَآءُ ۚ نُصِيبُ بِرَحْمَتِنَا مَن نَّشَآءُ ۖ 
وَلَا نُضِيعُ أَجْرَ ٱلْمُحْسِنِينَ ‎
‏وَلَأَجْرُ ٱلْءَاخِرَةِ خَيْرٌۭ لِّلَّذِينَ ءَامَنُوا۟ وَكَانُوا۟ يَتَّقُونَ
The story of Joseph in the Qurʾān is a continuous narrative. There are more than one hundred verses, and in totality they encompass many years and “present an amazing variety of sciences and characters in a tightly-knit plot, and offer a dramatic illustration of some of the fundamental themes of the Qurʾān.
اس طرح ہم نے یوسف کو ملک (مصر) میں جگہ دی اور وہ اس ملک میں جہاں چاہتے تھے رہتے تھے۔ 
ہم اپنی رحمت جس پر چاہتے ہیں کرتے ہیں اور نیکوکاروں کے اجر کو ضائع نہیں کرتے 
اور جو لوگ ایمان لائے اور ڈرتے رہے ان کے لیے آخرت کا اجر بہت بہتر ہے
The Qurʾān itself relates to the story’s importance in the third verse: “and We narrate unto you aḥsanal-qaṣaṣ (Arabic: أحسن ٱلقصص, “best (or most beautiful) of stories”).
” Most scholars believe this is referring to Joseph’s story, while others, including Ṭabari, argue it is a reference to the Qurʾān as a whole.
It asserts and documents the execution of God’s rulings despite the challenge of human intervention (“And Allah hath full power and control over His affairs; but most among mankind know it not”).
This is what the story of Yūsuf confirms categorically, for it ends with comfort and marvels, which is described in the Qurʾān

Quran 39:55~59

Follow ˹the Quran,˺ the best of what has been revealed to you from your Lord, before the punishment takes you by surprise while you are unaware,so that no ˹sinful˺ soul will say ˹on Judgment Day˺, ‘Woe to me for neglecting ˹my duties towards˺ Allah, while ridiculing ˹the truth˺.’Or ˹a soul will˺ say, ‘If only Allah had guided me, I would have certainly been one of the righteous.’Or say, upon seeing the torment, ‘If only I had a second chance, I would have been one of the good-doers.’Not at all! My revelations had already come to you, but you rejected them, acted arrogantly, and were one of the disbelievers.”Quran 39:55~59
Surah 39: az-Zumar (The Groups)
click the button above to listen to the recitation of these Quranic verses again
وَٱتَّبِعُوۤا۟ أَحۡسَنَ مَاۤ أُنزِلَ إِلَیۡكُم مِّن رَّبِّكُم مِّن قَبۡلِ أَن یَأۡتِیَكُمُ ٱلۡعَذَابُ بَغۡتَةࣰ وَأَنتُمۡ لَا تَشۡعُرُونَ

أَن تَقُولَ نَفۡسࣱ یَـٰحَسۡرَتَىٰ عَلَىٰ مَا فَرَّطتُ فِی جَنۢبِ ٱللَّهِ 
وَإِن كُنتُ لَمِنَ ٱلسَّـٰخِرِینَ

أَوۡ تَقُولَ لَوۡ أَنَّ ٱللَّهَ
هَدَىٰنِی لَكُنتُ مِنَ ٱلۡمُتَّقِینَ

أَوۡ تَقُولَ حِینَ تَرَى ٱلۡعَذَابَ لَوۡ أَنَّ لِی كَرَّةࣰ فَأَكُونَ مِنَ ٱلۡمُحۡسِنِینَ

بَلَىٰ قَدۡ جَاۤءَتۡكَ ءَایَـٰتِی فَكَذَّبۡتَ بِهَا وَٱسۡتَكۡبَرۡتَ وَكُنتَ مِنَ ٱلۡكَـٰفِرِینَ
The Surah takes its name from the mention of ‘az-Zumar’ in (39:71) and (39:73). These are the only mention of the words zumar in the whole Qur’an. There are 88 Ayat in this Surah.
اور پیروی اختیار کر لو اپنے رب کی بھیجی ہوئی کتاب کے بہترین پہلو کی، 
قبل اِس کے کہ تم پر اچانک عذاب آئے 
اور تم کو خبر بھی نہ ہو 

کہیں ایسا نہ ہو کہ بعد میں کوئی شخص کہے

"افسوس میری اُس تقصیر پر جو میں اللہ کی جناب میں کرتا رہا، بلکہ میں تو الٹا مذاق اڑانے والوں میں شامل تھا" 

یا کہے 

"کاش اللہ نے مجھے ہدایت بخشی ہوتی تو میں بھی متقیوں میں سے ہوتا" 

یا عذاب دیکھ کر کہے 

"کاش مجھے ایک موقع اور مل جائے اور میں بھی نیک عمل کرنے والوں میں شامل ہو جاؤں" 

(اور اُس وقت اسے یہ جواب ملے کہ) 

"کیوں نہیں، 
میری آیات تیرے پاس آ چکی تھیں، 
پھر تو نے انہیں جھٹلایا اور تکبر کیا 
اور تو کافروں میں سے تھا"
The Surah talks about the true religion. It is to serve Allah sincerely and to avoid Shirk. Tawhid brings the blessings of Allah, while Shirk has terrible consequences. The Believers are told not to despair and lose heart. If it is difficult for them to practice their religion in one place, they can migrate from that land. The unbelievers are told that they can do whatever they wish, but they cannot turn the Believers away from the path of faith.