The Torah commands us (17:5), ולא יהיה כקרח וכעדתו, "Don't be like Korach and his congregation." We must do everything possible to avoid machlokes.
The Chazon Ish zt'l said, "When one is in the wrong and doesn't have a valid reason to make a machlokes, of course he shouldn't make a machlokes. The Torah refers to when there is a legitimate reason to be angry. Nevertheless, the Torah says, ולא יהיה כקרח, don't be like Korach. Seek ways to avoid machlokes.
Aharon was the exact opposite of Korach; he was a man of peace. Pirkei Avos (1:12) states, "Be among Aharon's students: Pursue peace, love people, and draw them to Torah."
The Ramban (16:4) writes, "Aharon, following his path of mussar and kedushah, remained silent during this machlokes. He was quiet as though he agreed that Korach was greater than him [and more suitable for the position of kohen gadol], and was merely acting upon Moshe’s command, and was keeping the king's decrees."
Amazingly, the machlokes was against him, but he didn't partake in it. Pirkei Avos (5:17) says that an example of a machlokes l'shem shamayim is the machlokes between Hillel and Shamai. "A machlokes that isn't l'shem shamayim is the machlokes of Korach and his community." Notice that the Mishnah doesn't state "Korach and Aharon." This is because Aharon was never part of the machlokes. Korach was running the machlokes on his own, and Aharon completely removed himself from the dispute.
Moshe Rabbeinu was also a man of peace and sought with all his strength to end the machlokes and make peace. As we see, (16:12, and 16:25) וישלח משה לקרא לדתן ולאבירם... ויקם משה וילך אל דתן ואבירם. Moshe was trying to make peace with Dasan v'Aviram. Rashi (16:22) writes, מכאן שאין מחזיקין במחלוקת, "We learn from here that one shouldn't persist in machlokes." We should try to make amends and end machlokes as quickly as possible.
Rashi (Sanhedrin 110.) writes, "We must learn from Moshe Rabbeinu. He forgave Dasan and Aviram for disgracing him and went to them to end the machlokes."
The Shlah (Korach, Derech Chaim Tochachas Mussar, 26) writes, "Whatever a person can do to increase peace and to extinguish the fires of machlokes, he should do so. Moshe Rabbeinu was a king and the greatest navi, but that didn’t stop him from reaching out to Dasan and Aviram to make peace. When Dasan and Aviram refused to speak to him (they said Bamidbar 16:14) לא נעלה, 'We will not go up,' Moshe went to the elders of Yisrael, all for the sake of restoring peace."
There is a Talmudic concept called "chazakah," which means we assume that the current status of something will continue to remain the same. The Chasam Sofer says that אין מחזיקין במחלוקת can be translated as, "When it comes to machlokes, we don't assume (חזקה) that what was, will continue." Dasan and Aviram were always causing machlokes. Our first encounter with Dasan and Aviram takes place in Mitzrayim, where it states (Shemos 2:13), והנה שני אנשים עברים נצים, "[Moshe saw] two Jewish people fighting," and Rashi tells us that they were Dasan and Aviram. From the very beginning, we find them to be the instigators of quarrels. Later, Dasan and Aviram tattled (מלשין) to Pharaoh that Moshe killed the Mitzri, forcing Moshe to escape Mitzrayim (see Rashi, Shemos 2:15). Dasan and Aviram challenged Moshe when Pharaoh increased the workload on Bnei Yisrael (see Rashi, Shemos 5:20). They also disregarded Moshe's command and kept manna for the following day (see Rashi, Shemos 2:13). At the machlokes of Korach, Dasan and Aviram were there again.
The Chasam Sofer zt'l writes that Moshe had every reason to say, "Dasan and Aviram are always fighting. They create machlokes at every opportunity. It is impossible to make peace with such people." It would have been rational for Moshe to claim this, but Moshe didn't. He tried to make peace with them. He thought, "Perhaps this time I can make peace with them." אין מחזיקין במחלקת, when it comes to machlokes, we don't assume it will continue. Perhaps this time I will succeed in ending the machlokes.