This enlightens us as to why the sons of Korach expressed their gratitude to HKB”H for His abundant mercy and kindness by formulating this psalm. As they expounded in the Midrash: “The kings assembled” refers to Yehudah and Yosef. “They came together”—they each filled with rage against the other, because each one believed that his way was right. Yosef espoused the way of the tzaddik, and Yehudah espoused the way of the ba’al teshuvah.
“They saw and they were indeed astounded”—the spectators were bewildered. “They were confounded and fled in haste”—his brothers were unable to respond to him, because they were in shock. The shevatim witnessing this confrontation were confounded by the two distinct approaches. Additionally, upon becoming aware of Yosef’s true identity, they were astounded (shocked) by his incredible kedushah. Upon recognizing that he was the epitome of a tzaddik: “Trembling gripped them there”—this refers to the shevatim who said: “Kings are debating one another, what concern is it of ours, it is fitting for a king to confront a king.”
Let us explain. After being bewildered by the dispute between Yehudah and Yosef, the shevatim understood via their “ruach hakodesh” that HKB”H had orchestrated the confrontation of these two kings. They recognized the veracity of both doctrines and that both were equally good and vital. This understanding elicited their response: “Kings are debating one another, what concern is it of ours”—i.e., we need the crucial combination of both paths to endure. “Kings are debating one another, what concern is it of ours”—so they stood by and did not intervene. For this reason, Yaakov Avinu sent Yehudah to meet up with Yosef to prepare a house of study from which instruction would originate—how to utilize both methods of serving Hashem. This awareness gave the sons of Korach cause to rejoice. Seeing how much HKB”H values the act of teshuvah, they praised Hashem with their song.
Now, we learned from the Zohar hakadosh that the leviim sang this mizmor on the second day of every week, since Gehinnom was created on that day. By doing so, they were able to free reshaim from Gehinnom who had thoughts of teshuvah. This implies that reciting this mizmor is an auspicious device to arouse a person to perform teshuvah and avoid going to Gehinnom in the first place. Now, if we combine the merit of the tzaddikim who emulate Yosef with the merit of the penitents who emulate Yehudah, we will deserve HKB”H sending us the two Mashiachs—ben Yosef and ben David—who will bring about the complete geulah—swiftly, in our times! Amen.