Vayikra / Leviticus 10:6 · Pshat
וַיֹּאמֶר מֹשֶׁה אֶל־אַהֲרֹן וּלְאֶלְעָזָר וּלְאִיתָמָר בָּנָיו רָאשֵׁיכֶם אַל־תִּפְרָעוּ וּבִגְדֵיכֶם לֹא־תִפְרֹמוּ וְלֹא תָמֻתוּ וְעַל כָּל־הָעֵדָה יִקְצֹף וַאֲחֵיכֶם כָּל־בֵּית יִשְׂרָאֵל יִבְכּוּ אֶת־הַשְּׂרֵפָה אֲשֶׁר שָׂרַף יְהוָה׃
And Moshe said to Aharon and to Elazar (Eleazar) and Itamar (Ithamar), his sons: "Do not let the hair of your heads grow loose and do not tear your garments, so that you do not die and He is not angry with all the congregation. But your brothers, the whole house of Israel, shall weep for the burning that the Eternal has kindled.
Pshat פְּשָׁט
Not darkening the joy
Sometimes a celebration and a grief arrive in the same hour. And you have to decide whom to give that hour to.
Rashi: the priests may not let their hair grow in mourning, so as not to darken the joy of the Omnipresent. The whole people mourns the loss of Torah scholars. Sforno: the Torah is stricter with Elazar (Eleazar) and Itamar (Ithamar) than with ordinary priests, because they are anointed. And all Israel weeps, so that the honor of the dead is not lessened.
How Rashi and Sforno explain it
Rashi Do not let your hair grow loose
Do not let your hair grow long. From here we learn that a mourner may not cut his hair. But you, do not darken the joy of the Omnipresent.
Rashi So that you do not die
But if you do so, you will die.
Rashi But your brothers, the whole house of Israel
From here we learn that the loss of Torah scholars falls on everyone, for all to mourn it.
Sforno Do not let the hair of your heads grow loose
Although the dead were among the close relatives for whom an ordinary priest becomes impure, he was stricter with these, because they were anointed, as it says: "for the anointing oil of the Eternal is upon you" (Vayikra / Leviticus 10:7).
Sforno The whole house of Israel shall weep
For two righteous and great men are gone. And so the honor of the dead will not be lessened.
Takeaway
Letting the hair grow loose and tearing the garments are signs of mourning: the Torah tells the leper to do the same (Vayikra / Leviticus 13:45).
An ordinary priest becomes impure for his closest relatives: mother, father, son, daughter and brother (Vayikra / Leviticus 21:1–3).
The anointing oil is the special oil with which Aharon (Aaron) and his sons were anointed as priests (Shemot / Exodus 30:30).
The joy of the Omnipresent is the day the Mishkan began to serve, the eighth day of the inauguration (Vayikra / Leviticus 9:1).