Your question relates to a few introductory concepts.
We live in what is called This World (עולם הזה). This is the time period which spans the current 6,000 year window, when a soul is dressed in a physical and material body for the purpose of labor or work.
At the end of ones lifespan (however long that term may be), their soul departs from that physical and material body and ceases to be enclothed within it.
That process is what is described as death (being dead). What are described as the five elements of the soul (Nefesh (or Living Soul, because it is the interface between the material, physical world and the Spiritual realm), Ruach, Neshamah, Chayah and Yechidah) separate for most people and enter into what is called the World of Souls (עולם הנשמות). When the Nefesh separates from the other soul elements, that individual loses the ability to interact with This World (עולם הזה). This is what is truly meant in Torah literature by the term death. This is discussed in detail by Rabbi Elazar Roke'ach in his commentary to the Mishnah, Ma'aseh Roke'ach, parshat Yitro 119 and also by the Vilna Ga'on, Sefer Orot HaGra, Adam, 15.
In this context, it is worth noting that there are a select few individuals who, because of their unique soul quality, do not experience this separation of their five soul elements when it separates from their physical, material body. Even after their soul leaves their material body, entering the World of Souls (עולם הנשמות), they continue to have the ability to interact and affect This (physical and material) World (עולם הזה). These are the individuals who are said to never die or to ascend alive, like Chanoch ben Yered, Yaacov Avinu and Eliyahu HaNavi.
In the initial (12 month period of that first) year when the soul separates from the physical, material body, there is a process of judgement or assessment, which determines the next stage of spiritual development for that individual. The completion of that judgement process can be very quick, even like the blink of an eye or extend over the majority of that first year.
If the lifespan of that individual (the time when that soul was dressed within its physical, material body) is judged meritorious, that soul ascends within the World of Souls to what is called Gan Eden (characterized by peace, tranquility, harmony, pleasure and non-violence) and its various stages.
There are broad, general categories referred to as the Lower Gan Eden and the Upper Gan Eden, but in texts that discuss this in more detail, it refers to 3,000 levels which correspond to the 3,000 allegories of Shlomo HaMelech. That each allegory is a level and kind of concealment of the true nature of G-d, a Hiding of His Face, so to speak. By ascending from level to level in Gan Eden within the World of Souls, referred to by the Hebrew phrase לך מחיל אל חיל, the individual achieves greater merit, removes the garment associated with that particular, lower level and achieves a more clear and undistorted perception of G-d. These different levels of clarity are often referred to by the terms אספקלריא המאירא and אספקלריא שאינו מאירא.
If the lifespan of that individual is judged lacking, that soul descends within the World of Souls to what is called Gehinom (גיהנם) (which has a connotation of violence (חמס). This is the first descent to Gehinom. It is also associated with the ideas of humiliation and embarrassment over realization of the wasted opportunity to achieve closeness to G-d which are connected with the heat from the allegorical flames of fire. It is worth noting that this is not speaking about actual violence or physical fire, but is a consequence of the quality of the lifespan that was lived by that individual while dressed in their physical, material body.
According to the teaching of some, there are five general levels to this domain in the World of Souls (which derive from those letters which have a final form (כ׳ך, מ׳ם, נ׳ן, פ׳ף, צ׳ץ), the five Gevurot and the five Chassadim). According to others (like Rabbi Meir Ibn Gabbai and Rabbi Yosef Gikatilla) there are seven general levels to Hell, corresponding to the seven levels of Heaven (and which derive from the seven doubling letters (ב,ג,ד,כ,פ,ר,ת) in the Aleph-Beit, meaning whether the letter has a dagesh or not). For detailed discussion of this subject, see Sha'ar HaGemul by Ramban and also Sefer Avodat HaKodesh by Rabbi Meir Ibn Gabbai.
Both the Gan Eden consequence and the Gehinom consequence are the proper and appropriate result from the assessment of that particular soul at the conclusion of its lifespan, measure for measure. That consequence is intended by the Creator only for the good of that particular soul and to its benefit and ultimate improvement.
The Torah sorts these individuals of the Human Race into two general groups, those who are called the Children of Israel and those who are called The Children of Noach.
The Torah says that in general, the Children of Israel, for a variety of reasons, conclude their individual lifespans with an assessment of overall merit. As a consequence, those souls ascend to some level of Gan Eden. This is why, for example, that Kaddish is not recited for a full 12 months for any Jew. Because their lifetime assessment is found to be meritorious by the 11th month at the latest.
Among the Children of Noach, there are some whose individual lifespan is assessed as meritorious. They are called the Righteous of the Gentile Nations (חסידי אומות העולם) and similar to the Children of Israel, ascend to their appropriate levels of Gan Eden. Some from this category are assessed as lacking and descend to Gehinom in this World of Souls for an additional process of soul refinement. (It is important to note that as used here, ascent and descent are describing the experience of individual closeness to the Creator.) This is what is referred to in some places within Torah as Immersion in a River of Fire, similar to the idea of smelting and refining metal. This is what is discussed, for example, in the prophesy of Daniel, chapter 2.
Toward the end of the 6,000 year time period the Torah teaches that there is a spiritual reassessment which is called the Great and Awesome Day of Judgement. (Joel 3:4, Malachi 3:23)
At this time is the period of the general resurrection (which includes both those still called living, like Eliyahu HaNavi and also of the dead, when both those who were initially judged as meritorious and those who were judged lacking will be resurrected. This period of resurrection includes both the Children of Israel and the Children of Noach, both those who were elevated to Gan Eden and those who descended to Gehinom.
All those who were initially assessed as meritorious will remain meritorious, but will be assessed for their spiritual, soul accomplishments that have occurred in Gan Eden. Additional accomplishments from this will be rewarded with increased elevation and closeness to the Creator. This is discussed in great detail by Rabbi Moshe Chaim Luzzato in Derech HaShem.
For the Children of Israel, their final assessment will included both a reward for the soul and a reward for their bodies. This is because of the nature of the commandments that they were tasked with, both positive and negative commandments. Their positive commandments pertain the their bodies, while their negative commandments pertain to the soul.
For the Children of Noach, their elevation and final assessment is for their soul only. This is because the quality and nature of their commandments are only negative/prohibitive. There are positive acts, like charity and acts of kindness that they can perform for their final benefit, but they are not commandments, so the nature of their benefit is different and spiritual only, not bodily.
Among the Children of Noach who were originally assessed as lacking and judged to descend to the state of Gehinom (the Smelting/Refinement Process), they will have a final assessment over their efforts during that continued refining period. It will be determined what they have achieved toward additional, individual refinement, improvement and elevation and whether their best ultimate reward is to remain in a state of eternal refinement and improvement or an elevation to some mixture of the Gan Eden level.
Each individuals final assessment is only for their good and their ultimate closeness to the Creator. For some, their best and eternal final reward state will be one in the state of Gehinom, perpetual and continuous refinement. Those who are judged this way return a second time to Gehinom. That is how they best experience a closeness to the Creator.