"Because shevet Reuven was on the south of the camp, a neighbor to Kehas and his sons, Dasan and Aviram [who were from shevet Reuven] joined with Korach in his dispute. Woe to the wicked one and woe to his neighbor!" (Rashi Bamidbar 16:1.) Dasan and Aviram were wicked long before they became Korach's neighbors (see Rashi Shemos 2:13) but would not have joined Korach's rebellion were it not for their proximity to him (Sifsei Chachamim).
Dasan and Aviram's proximity to Korach was divinely ordained (see Rashi Bamidbar 3:29). We recognize the divine role in these matters when we pray daily, "rescue me today and every day from an evil neighbor" (Berachos 16b). However, we must do our share in avoiding bad influences, as Chazal say, "Distance yourself from a bad neighbor" (Avos 1:7). "When a person chooses where to live, he should inquire about the neighbors, and move only near good ones" (R. Yonah). Our prayers, then, are asking that those who move near us subsequently will be good as well.
"We are influenced in our traits and deeds by our neighbors. One must relocate to a place of righteous and upright people. If that is impossible, one should lead a solitary life" (Rambam Hilchos Deos 6:1). In today's global village, extra care must be taken to avoid the negative influences of "neighbors" who appear on various screens in our homes. Rashi (Avos 2:9) explains that a good neighbor is critical because one sees him at all hours, day and night, and learns from his deeds. And bad neighbor can be detrimental for the same reason, and therefore one must distance himself from evil neighbors of all kinds.
"'Moshe and Aharon and his sons. And next to them, Yehudah, Yissachar and Zevulun.' Good for the righteous one and good for his neighbor! Because they were neighbors of Moshe, who learned Torah, they became great in Torah" (Rashi Bamidbar 3:38). Didn't Aharon and his sons also learn Torah (see Rashi 3:1)? Why does this Rashi only mention their being neighbors of Moshe and not Aharon and his sons? Apparently the example of Moshe, who was totally engrossed in Torah, exerted a greater influence on his neighbors than that of Aharon and his sons. Aharon was more involved with the people around him, pursuing peace and instilling love between quarreling parties or spouses. Remarkably, the more detached brother, Moshe, (Rashi 20:29, see Devarim 34:8) is credited for the greatness in Torah of the neighboring tribes.
On ben Peles, who had sworn to join Korach's rebellion, was saved by his wife from the fate of Korach and his fellow rebels. She knew that "the entire assembly is all holy" (16:3) and would not enter their house if her hair was uncovered. She therefore uncovered her hair, and all those who came to summon On saw her with her hair uncovered and left (Sanhedrin 109b-110a). By contrast, Korach's wife incited him to rebel against Moshe. Korach sought her advice (Bamidbar Rabbah 18:4), but she foolishly destroyed her home, whereas On's wife built hers (110a, see Mishlei 14:1).
A man's wife is his closest neighbor; her influence upon him is the most powerful and incessant one. Therefore, every man must seek a righteous wife who will help him do right and oppose him to prevent his doing wrong. If he is so blessed, he must thank Hashem for this wonderful gift, and pay careful attention to his wife's sage counsel.
"If a man and woman are meritorious, the Shechina is in their midst" (Sotah 17a). This additional level of the Divine Presence, literally the Neighborliness, of Hashem within a married couple reflects the higher level of sanctity that can be achieved in a marriage.
The wisdom of On's wife built her home; had she not opposed her husband, the entire home would have been destroyed, as was Korach's. Remarkably, even Korach's assembly, who forfeited both this world and the next (108a), were repulsed by On's wife's uncovered hair. This demonstrates the positive impact of communal standards of modesty, even on those who separated themselves from that very community (Rashi 16:1). Conversely, in our global community, it is challenging to avoid egregious violations of modesty, even for Orthodox Jews who recognize that they are separate from the global community. This challenge is even greater in the hot summer months for both men and women.
"'A close neighbor is better than a distant brother.' This refers to Hashem, Who is close to those who call Him" (Rashi Mishlei 27:10). Indeed, Hashem resides within Am Yisrael, even within its impure members (Rashi Vayikra 16:16). In this sense, He is the very closest neighbor of every Jew. Indeed, as Korach claimed, the entire assembly is holy. The challenge is to preserve this innate holiness by avoiding the evil influences of bad neighbors of all kinds, thus meriting the Divine Presence.