And I saw the dead, the great and the small, standing before the throne. Then books were opened, and another book was opened – the book of life. So the dead were judged by what was written in the books, according to their deeds. The sea gave up the dead that were in it, and Death and Hades gave up the dead that were in them, and each one was judged according to his deeds. Then Death and Hades were thrown into the lake of fire. This is the second death – the lake of fire. If anyone’s name was not found written in the book of life, that person was thrown into the lake of fire.” Revelation 20:12-15 NET https://bible.com/bible/107/rev.20.12-15.NET
At the end of time as we know it now, before a new time begins when God reigns upon the earth forever with His people who will also live with Him forever, judgment for determining who will live with God forever will occur. The Judge will be Jesus, Who gave His life to God as a sacrifice so that God could pardon people and He could live with people forever. Jesus’ death was punishment for humanity’s sins so that God could live with humanity. As a result, humanity can live with God, but Jesus died so that God could live with humanity and not primarily the other way around. God is holy. He is perfect. He is beyond moral description or comprehension and, therefore, cannot live forever with the corrupt. We are corrupt at birth. Depraved and deprived of any moral purity. We are separated from God at birth and must be born again to live with God. When we are genuinely born again, we must be born by the Spirit, evidenced by repentance and obedience. Those who never entered a second birth, all of those who think they are good but denied Jesus, failed to do what God calls good and so will be forever cast away from His presence to suffer eternally for their depravity. Only those pardoned by Jesus will live with Jesus forever. Their deeds will be rewarded by Jesus not because they were better than the condemned but because they complied with what God requires of humanity, what He calls good, which is to repent, believe in the work of Jesus, demonstrated by a wholehearted love for God that constantly seeks to obey His commands.