It means every human who has ever lived. We see this in the context.
John 5:25-29 “Truly, truly, I say to you, an hour is coming, and is now here, when the dead will hear the voice of the Son of God, and those who hear will live. 26 For as the Father has life in himself, so he has granted the Son also to have life in himself. 27 And he has given him authority to execute judgment, because he is the Son of Man. 28 Do not marvel at this, for an hour is coming when all who are in the tombs will hear his voice 29 and come out, those who have done good to the resurrection of life, and those who have done evil to the resurrection of judgment. (ESV)
Notice verse 25; "the dead will hear the voice of the Son of God and those who hear will live". Jesus does not discriminate between the righteous and the unrighteous when it comes to "who hears and lives." He simply says, "the dead", implying those who have died, which includes both the righteous and the unrighteous. He then goes on to say that he has the authority to execute judgment. The word for "judgment" there is κρίσις(Strong's G2920). It's the same word that appears in verse 29, i.e. "resurrection of judgment[κρίσις]". I don't see any reason to think that the "judgment" Jesus can execute is not linked with the "resurrection of judgment", considering they're within the same context and the same words(κρίσις) are used.
Now it is unequivocal that those "who are in the tombs" and "hear his voice and come out" are both the righteous and the unrighteous, as verse 29 explicitly states that both those who have done good(i.e. righteous) and those who have done bad(i.e. unrighteous) will be resurrected. This includes all humans who have ever lived, as all humans who have ever lived have been either righteous or unrighteous; there is no in-between.
Now, are the unrighteous necessarily resurrected to condemnation? No.
Here's Strong's Concordance of κρίσις;
Decision (subjectively or objectively, for or against); by extension, a tribunal; by implication, justice (especially, divine law) -- accusation, condemnation, damnation, judgment.
Here is Thayer's Greek Lexicon of κρίσις;
κρίσις, κρίσεως, ἡ, the Sept. for דִּין, רִיב (a suit), but chiefly for מִשְׁפָּט; in Greek writings ((from Aeschylus and Herodotus down))
- a separating, sundering, separation; a trial, contest.
- selection.
- judgment; i. e. opinion or decision given concerning anything, especially concerning justice and injustice, right and wrong;
a. universally: John 8:16; 1 Timothy 5:24 (on which see ἐπακολουθέω); Jude 1:9; 2 Peter 2:11; κρίσιν κρίνειν (see κρίνω, 5 b.), John 7:24.
b. in a forensic judgment sense, of the of God or of Jesus the Messiah: universally, James 2:13; 2 Thessalonians 1:5; Hebrews 10:27; plur, Revelation 16:7; Revelation 19:2; of the last judgment: Hebrews 9:27; ἡ ἡμέρα κρίσεως (Matthew 10:15; Matthew 11:22, 24; Matthew 12:36; Mark 6:11 R L in brackets; 2 Peter 2:9; 2 Peter 3:7) or τῆς κρίσεως (1 John 4:17), the day appointed for the judgment, see ἡμέρα, 3; εἰς κρίσιν μεγάλης ἡμέρας, Jude 1:6; ἡ ὥρα τῆς κρίσεως αὐτοῦ, i. e. τοῦ Θεοῦ, Revelation 14:7; ἐν τῇ κρίσει, at the time of the judgment, when the judgment shall take place, Matthew 12:41; Luke 10:14; Luke 11:31f; κρίσιν ποιεῖν κατά πάντων, to execute judgment against (i. e. to the destruction of) all, Jude 1:15. Specifically, sentence of condemnation, damnatory judgment, condemnation and punishment: Hebrews 10:27; 2 Peter 2:4; with the genitive of the person condemned and punished, Revelation 18:10; ἡ κρίσις αὐτοῦ ἤρθη, the punishment appointed him was taken away, i. e. was ended, Acts 8:33 from Isaiah 53:8, the Sept.; πίπτειν εἰς κρίσιν (Rst εἰς ὑπόκρισιν), to become liable to condemnation, James 5:12; αἰώνιος κρίσις, eternal damnation, Mark 3:29 (Rec.); ἡ κρίσις τῆς γηννης, the judgment condemning one to Gehenna, the penalty of Gehenna, i. e. to be suffered in hell, Matthew 23:33. In John's usage κρίσις denotes α. that judgment which Christ occasioned, in that wicked men rejected the salvation he offered, and so of their own accord brought upon themselves misery and punishment: αὕτη ἐστιν ἡ κρίσις, ὅτι etc. judgment takes place by the entrance of the light into the world and the batted which men have for this light, John 3:19; κρίσιν, to execute judgment, John 5:27; ἔρχεσθαι εἰς κρίσιν, to come into the state of one condemned, John 5:24; κρίσις τοῦ κόσμου τούτου, the condemnatory sentence passed upon this world, in that it is convicted of wickedness and its power broken, John 12:31; περί κρίσεως, of judgment passed (see κρίνω, 5 a. β. at the end), John 16:8, 11. β. the last judgment, the damnation of the wicked: ἀνάστασις κρίσεως, followed by condemnation, (cf. Winer's Grammar, § 30, 2 β.). γ. both the preceding notions are combined in ; ἡ κρίσις πᾶσα, the whole business of judging (cf. Winer's Grammar, 548 (510)), ibid. 22. Cf. Groos, Der Begriff der κρίσις bei Johannes (in the Studien und Kritiken for 1868, pp. 244-273).
- Like the Chaldean דִּינָא (Daniel 7:10, 26; cf. German Gericht) equivalent to the college of judges (a tribunal of seven men in the several cities of Palestine; as distinguished from the Sanhedrin, which had its seat at Jerusalem (cf. Schürer, Neutest. Zeitgesch. § 23, ii.; Edersheim, Jesus the Messiah, ii. 287)): Matthew 5:21f (cf. Deuteronomy 16:18; 2 Chronicles 19:6; Josephus, Antiquities 4, 8, 14; b. j. 2, 20, 5).
- Like the Hebrew מִשְׁפָּט (cf. Gesenius, Thesaurus, iii., p. 1464b (also the Sept. in Genesis 18:19, 25; Isaiah 5:7; Isaiah 56:1; Isaiah 59:8; Jeremiah 17:11; 1 Macc. 7:18; and other passages referred to in Gesenius, the passage cited)), right, justice: Matthew 23:23; Luke 11:42; what shall have the force of right, ἀπαγγέλλειν τίνι, Matthew 12:18; a just cause, Matthew 12:20 (on which see ἐκβάλλω, 1 g.).
As you can see, κρίσις can mean "condemnation" or "damnation", but it can also mean "judgment concerning right or wrong", or a "trial/tribunal". Thus, the resurrection of the unrighteous is not necessarily one to condemnation. This is made clearer considering the fact that Jesus had only just said he had "authority to execute judgment". Every translation I've ever looked at translates κρίσις there as "judgment". As I said before, considering how both the "resurrection to judgment" and "authority to execute judgment" are within the same context(and use the same word κρίσις), they must directly correlate to each other, i.e. the authority to execute judgment that Jesus has is the authority that will be used in the resurrection of the unrighteous to judgment. That's not terribly surprising, is it? Well, no, but it's a big deal. How so?
A judgment can result in both negative and positive outcomes. For example, a court of law can judge someone to be either guilty(negative) or innocent(positive). What the judgment is, however, is not known until it is passed. Considering that Jesus has not passed judgment on the unrighteous resurrected(you know, because they haven't been resurrected yet), we do not know what the judgment of some will be. No one can say that they know for sure that all the unrighteous will be condemned to destruction because Jesus has not yet passed the judgment! It would be incredibly arrogant to pass judgment on the unrighteous resurrected before they have even been judged by the one judging them(Jesus)! It's entirely possible that many who are resurrected will be judged and acquitted of their sins and given everlasting life. This is highly substantiated by Daniel 12:2.
Daniel 12:2 "And many who sleep in the dust of the earth will awake, some to everlasting life, but others to shame and everlasting contempt."
Notice there is no distinction made apropos the "awakening" between those who gain everlasting life and those who gain shame and everlasting contempt. The passage simply says that many who sleep in the dust of the earth will awake, with no suggestion whatsoever that there are two different "awakenings"(i.e. one for the righteous and another for the unrighteous, as is explicitly stated in John 5:29). There is absolutely no mention of righteous or "those who did good things", and likewise absolutely no mention of unrighteous or "those who did bad things"; as there is in John 5:29. Daniel 12:2 is highly ambiguous, to say the least. It's entirely possible that Daniel 12:2 is referring to the resurrection of the unrighteous! This is further supported by the fact that Daniel 12:2 does not say "all who sleep in the dust of the earth will awake"; it says "many who sleep in the dust of the earth will awake". Perhaps that is an insignificant detail, perhaps not. If not, this fits perfectly with Daniel 12:2 talking about the resurrection of the unrighteous for two reasons;
(1) There would be some not part of this resurrection in Daniel 12:2, i.e. the righteous ones resurrected to life(John 5:29, Luke 14:14, Acts 24:15, Revelation 20:4-6).
(2) The great majority of those resurrected will be unrighteous. The current estimate by the Population Reference Bureau for how many humans have ever lived is 107,000,000,000. How many of these have been deemed righteous by God? Better yet, how many of these have had a chance to put faith in what Jesus did on the cross, i.e. how he provided a means of atonement for our sins, so that the wrath of God may be lifted off of us? Certainly not the great majority.
The bottom line is that the majority of people who have ever lived have never had a chance to put faith in Jesus, which is the sole means of salvation. Whether they did good works or bad works is irrelevant, because it doesn't matter how many good works you do, it is never enough to earn your salvation; thus, faith in Jesus is a requirement. But how exactly is one supposed to put faith in Jesus, if one has never even heard about him? I'm not talking about his name; I'm talking about what he did on the cross. Remember, you have to accept Jesus as your sole means of atonement for your sins, and you do so by realizing that he alone opened the opportunity for them to be paid in full at his death on the cross. If one is completely unaware of this basic fact, one is incapable of accepting it(you cannot accept what you do not know), and thus incapable of gaining salvation. Unquestionably, billions of people have lived and never been aware of this fact(e.g. Sodom and Gomorrah. I wonder what Jesus has to say about them?), thus billions have never been given a chance at salvation. I believe that they will be given a chance at everlasting life during the resurrection of judgment. This is why Daniel 12:2 says that some will awaken to "everlasting life".
All the foregoing is further highly substantiated by Jesus' words at Matthew 10:14-15, Matthew 11:20-24, and Luke 10:10-12.
Matthew 10:14-15 "And if anyone will not receive you or listen to your words, shake off the dust from your feet when you leave that house or town. 15 Truly, I say to you, it will be more bearable on the day of judgment for the land of Sodom and Gomorrah than for that town."
Matthew 11:20-24 Then he began to denounce the cities where most of his mighty works had been done, because they did not repent. 21 “Woe to you, Chorazin! Woe to you, Bethsaida! For if the mighty works done in you had been done in Tyre and Sidon, they would have repented long ago in sackcloth and ashes. 22 But I tell you, it will be more bearable on the day of judgment for Tyre and Sidon than for you. 23 And you, Capernaum, will you be exalted to heaven? You will be brought down to Hades. For if the mighty works done in you had been done in Sodom, it would have remained until this day. 24 But I tell you that it will be more tolerable on the day of judgment for the land of Sodom than for you.”
Luke 10:11-12 ‘Even the dust of your town that clings to our feet we wipe off against you. Nevertheless know this, that the kingdom of God has come near.’ 12 I tell you, it will be more bearable on that day for Sodom than for that town.
Can you brush off the words of Jesus as though they are empty or meaningless? If one was set on the resurrection of the righteous to judgment(John 5:29) being a resurrection of condemnation, that is exactly what you'd have to do. There is only one condemnation at final judgment; the punishment of eternal destruction. Both those in the cities of Sodom and Gomorrah and those in the city of Capernaum will be resurrected as the unrighteous to judgment; if this resurrection to judgment is a resurrection to condemnation, then both the Sodom and Gomorrah and Capernaum will be condemned to the only punishment at the final judgment, i.e. eternal destruction. How exactly then is judgment supposed to be more bearable for Sodom than for Capernaum, if both are condemned to the same? Eternal destruction is not more bearable than eternal destruction! If one were to be so arrogant and say that the resurrection of judgment in John 5:29 is definitely a resurrection of condemnation(arrogant because the judgment itself has not been passed yet by the only one capable of making such a judgment, i.e. God!), then Jesus' words at Matthew 10:14-15, Matthew 11:20-24, and Luke 10:10-12 are in fact meaningless. It is not more bearable for Sodom than for Capernaum, because both were condemned to the very same fate!
But why is it that it will be more bearable for Sodom than for Capernaum? What's the distinction between the two? Those in Capernaum were given a chance to repent and accept the message of Jesus(i.e. that the kingdom of God is near; Luke 10:9) but did not repent(Matthew 11:20) or accept the message of Jesus(Matthew 10:14, Luke 10:10-11). On the other hand, those in Sodom and Gomorrah were neither given a chance to repent nor given a chance to accept the kingdom of God. That is why it will be more bearable Sodom than for a city that had a chance to repent and accept the kingdom of God but did neither; they will be given a chance to accept the message of Jesus, and thus a chance at everlasting life(Daniel 12:2).
In conclusion, using Daniel 12:2, Matthew 10:14-15, Matthew 11:20-24, and Luke 10:10-12, one can make a solid case for many of the unrighteous resurrected being given a chance at everlasting life(i.e. those who never had one in the first place, e.g. Sodom and Gomorrah).
Have a good day! Hope this helps. :)