The Gemara in Rosh Hashanah 17b (based on the last verse in Isaiah) says as follows:
אֲבָל הַמִּינִין וְהַמָּסוֹרוֹת וְהָאֶפִּיקוֹרְסִים שֶׁכָּפְרוּ בַּתּוֹרָה, וְשֶׁכָּפְרוּ בִּתְחִיַּית הַמֵּתִים, וְשֶׁפֵּירְשׁוּ מִדַּרְכֵי צִבּוּר, וְשֶׁנָּתְנוּ חִיתִּיתָם בְּאֶרֶץ חַיִּים, וְשֶׁחָטְאוּ וְהֶחְטִיאוּ אֶת הָרַבִּים, כְּגוֹן יָרׇבְעָם בֶּן נְבָט וַחֲבֵירָיו — יוֹרְדִין לְגֵיהִנָּם וְנִידּוֹנִין בָּהּ לְדוֹרֵי דּוֹרוֹת, שֶׁנֶּאֱמַר: ״וְיָצְאוּ וְרָאוּ בְּפִגְרֵי הָאֲנָשִׁים הַפּוֹשְׁעִים בִּי וְגוֹ׳״.
Translation:
But the heretics; and the informers; and the apostates [apikorsim]; and those who denied the Torah; and those who denied the resurrection of the dead; and those who separated from the ways of the Jewish community and refused to share the suffering; and those who cast their fear over the land of the living; and those who sinned and caused the masses to sin, for example, Jeroboam, son of Nebat, and his company; all of these people descend to Gehenna and are judged there for generations and generations, as it is stated: “And they shall go forth, and look upon the carcasses of the men that have rebelled against Me; for their worm shall not die; neither shall their fire be quenched; and they shall be an abhorrence to all flesh” (Isaiah 66:24).
Tosafos (Bava Metzia 58b) explains that this means that those mentioned in the list above - if they did not repent in their lifetime - remain in Gehinom longer than all the other sinners, who remain there only for a year
The Rama Mipano in his book “עשרה מאמרות” in ״מאמר חיקור הדין חלק ה׳ פרק א״ writes that this does not mean that they will remain there eternally, but rather for a longer time than the rest