Leviticus 24:12 ויקרא כ״ד:י״ב
1 א

לבדו. [נח"י] נתן טעם לפי שהמקושש היה רשע חמור שהרי היו יודעים הכל שהוא במיתה, והמקלל היה רשע קל שהרי לא היו יודעים אם הוא חייב מיתה או לא לכך לא היו חובשין ביחד כדאיתא בגמרא ב' בתי קברות היו לנסקלין ולנשרפים, כך אין חובשין רשע גמור אצל רשע קל:

By himself.. [Afterwards Rashi] explains [that he was imprisoned by himself] because the woodgatherer was more wicked, since everyone knew that he was liable for the death penalty, whereas the blasphemer was less wicked, for they did not know whether or not he was liable for the death penalty. Therefore they were not imprisoned together. As the Gemara says that there were two cemeteries, one for those whom [Beis Din] stoned, and one for those whom they burnt [because stoning is punishment for a more serious sin]. Similarly, we do not imprison someone who is [considered] more wicked together with someone who is [considered] less wicked. (Nachalas Yaakov)

2 ב

שהמקושש במיתה. זה טעם הוא אלעיל למה לא הניחום ביחד ומפרש לפי שיודעין שזה במיתה אבל מקלל לא היו יודעין שהוא במיתה ושמא לא יהיה במיתה ויצטער זה שסבר הואיל ויושבין יחד:

That one who gathered wood [on Shabbos] was [condemned] to death. This is a reason for the above, why he [Moshe] did not put them together. He [Rashi] explains that this was because they knew that this one was liable to death, but did not know whether the blasphemer was liable to death. Perhaps he was not liable to death and would suffer by thinking, that because they are sitting together [he too, must be liable to death].

3 ג

באיזו מיתה. וא"ת כיון שהיו יודעין שמחלל שבת במיתה למה לא דנוהו בחנק דהא כל סתם מיתה שבתורה היא חנק. י"ל שסבורין שהמחלל שבת כאלו עובד ע"א וכופר בהקב"ה כיון שאין מאמין ששבת הקב"ה במעשה בראשית אין מאמין שהקב"ה ברא העולם וכאלו מאמין בע"א, ושמא כמו שע"א בסקילה כך מחלל שבת בסקילה או שמא חנק לכך היו מסופקים: [ד"ד] הרבה מקשים למה נסתפקו והלא אף במקלל אב ואם חייב מיתה ק"ו לשכינה, וא"ל דאין עונשין מן הדין א"כ פשיטא שאין חייב מיתה כיון שאין בפי', ונראה דהספק היה כאן שלא היה שם התראה כדין דהא קיי"ל בסנהדרין בכל עבירות אינו חייב עד שיתרו בו שחייב מיתה ובאיזה מיתה ימות אלא דכאן הוראת שעה היתה:

The execution itself. You might ask: Since they knew that one who desecrates Shabbos is liable to death, why did they not punish him with strangling, since every unspecified death penalty in the Torah is by strangling? The answer is: They thought that one who desecrates Shabbos is like an idolater and an atheist; since he does not believe that the Holy One rested at Creation he does not believe that the Holy One created the world, and it is as if he believes in idolatry. And perhaps, just as idolatry is punished by stoning, so too one who desecrates Shabbos is punished by stoning, or perhaps [he is punished by] strangling. Therefore, they were in doubt. Many ask, why was there any doubt? If someone who curses a father or mother is liable to death, how much more so regarding the Divine Presence? You cannot answer that we do not derive punishment from a kal vachomer, because if so, it would be obvious that he was not liable for death since [the prohibition against blasphemy] was not explicitly [stated until now]. It seems that they were in doubt here because he had not been warned properly, and the Gemara rules in Sanhedrin that a person is not liable for any sin unless he was warned that he will be liable to death and also the type death he is liable for. This however, was a temporary injunction [valid only] for that particular time [to kill him without prior warning]. (Divrei Dovid)