The word "world" possesses a variety of definitions in scripture, and the context of the word "world" generally sets the definition.
The Greek word κόσμος (kosmos, Strong's 2889 - world) translates to "world".
Paul mentions "before the foundation of the world" (Ephesians 1:4) in the passage.
The "world" as used by Paul here indicates all the earth and all that is in it.
Paul refers to the time before the earth ("world") was created.
The word "world" in Ephesians 1:4 is the earth and all that is in the earth.
The first order is to look at Lord Jesus' words as recorded by the Apostle John:
"As Moses lifted up the serpent in the wilderness, even so must the Son of Man be lifted up; so that every believing will in Him have eternal life, for God so loved the world, that He gave His only begotten Son, that every believing in Him shall not perish, but have eternal life." (John 3:14-16).
The second order is to examine the history of "the serpent in the wilderness" that Jesus mentions (see John 3:14):
Then YHWH said to Moses, "Make a fiery [serpent], and set it on a standard; and it shall come about, that everyone who is bitten, when he looks at it, he will live." And Moses made a bronze serpent and set it on the standard; and it came about, that if a serpent bit any man, when he looked to the bronze serpent, he lived. (Numbers 21:8-9)
The third order is to listen to the Master.
Jesus sets "the serpent in the wilderness" "lifted up" in relation to "the Son of Man" "lifted up" (all in John 3:14).
Jesus then states "so that every believing will in" Jesus "have eternal life" (John 3:15), but He intensifies this statement by repeating it right away.
Jesus continues with "for God so loved the world, that He gave His only begotten Son" (John 3:16), and here is where Jesus mentions "world".
Jesus follows up with intensifying his prior declaration (John 3:15) with "that every believing in Him shall not perish, but have eternal life" (John 3:16).
The fourth order is to acknowledge the Master's words.
Jesus mentioned "the serpent in the wilderness", so by this He brings up the account of the bronze serpent (John 3:16 includes Numbers 21:8-9).
The relation that Jesus set between the bronze serpent lifted up and Himself lifted up bears significance upon the population of persons that Jesus establishes for the word "world" in John 3:16.
For the next four paragraphs, we see the Word of God speaking to Moses (Numbers 21:8) in relation to the Word of God speaking to Nicodemus (John 3:16).
Notice how "everyone who is bitten" (Numbers 21:8) relates to "world" (John 3:16).
Notice how "when he" (Numbers 21:8) relates to "that every one" (John 3:16, note that the singular (not plural) Greek word pas [Strongs 3956] translates accurately as "every one" not so much as the unfettered promiscuous "whosoever" [KJV] or "whoever" [NASB]).
Notice how "look" (Numbers 21:8) relates to "believing" (John 3:16).
Notice how "live" (Numbers 21:8) relates to "eternal life" (John 3:16).
God told Moses that a person bitten by one of the serpents "will live" when the person looks at "the serpent in the wilderness".
Based on God's command about "the serpent in the wilderness" (Numbers 21:8) and the results of the bronze serpent that Moses set on the standard (Numbers 21:9), the population of persons that certainly were affected by God's command about "the serpent in the wilderness" in order to live were ONLY each bitten person that looked at "the serpent in the wilderness".
In other words, the population of persons associated with living by looking at "the serpent in the wilderness" was restricted to ONLY the bitten persons that looked at the bronze serpent. For simplicity, I'll call this the "population of bitten look livers".
Furthermore, there is a different population of persons. This population of persons are not in the "population of bitten look livers". For example, this population of persons could include bitten persons that DID NOT LOOK AT "the serpent in the wilderness" after the "the serpent in the wilderness" was set on a pole/standard (Numbers 21:9). As another example, this population of persons certainly includes bitten persons that DID NOT LOOK AT "the serpent in the wilderness" due to the many people of Israel (Numbers 21:6) who were dead before God Almighty commanded Moses to make the "the serpent in the wilderness" "and set it on a standard" (Numbers 21:8). This population of persons I'll call the "population of bitten-non-lookers".
Therefore, there are separate populations of persons identified in Jesus' words as recorded by the Apostle John (John 3:14-16). There was the "population of bitten look livers"; meanwhile, there was the "population of bitten-non-lookers".
Jesus utilized a comparator in which a group of many persons in the "population of bitten-non-lookers" were incapable of looking at the "the serpent in the wilderness" because that subset of people were dead prior to Moses fashioning the bronze serpent (Numbers 21:9), so Jesus sets the same standard for a subset of persons in the "world" (John 3:16) because that group of people are incapable of seeing King Jesus (John 3:3-8).
Jesus sets the relation between differing populations of persons by way of Him including the "population of bitten look livers" (John 3:14, Numbers 21:9) and the population of persons represented by the word "world" who believe in Jesus (John 3:16).
God requires for persons to believe in Jesus in order to be granted eternal life by God (John 3:15, John 3:16).
So, it follows, when Lord Jesus says "God so loved the world" (John 3:16), then specifically He is saying God loves the ones who will believe in Jesus whom the Father has sent (John 6:29).
This relation set by Jesus establishes that the word "world" as used by Jesus in John 3:14-16 includes ONLY the population of persons that currently believe in Jesus or will in the future believe in Jesus.
The Word of God conclusively proves that the context establishes the "world" as the population of God's chosen persons ONLY.
Before and after saying "world", Jesus establishes the requirement of believing in Jesus in order for persons to be in the population of persons granted eternal life by God.
Jesus, the Word of God, says "This is the work of God, that you believe in Him whom He has sent" (John 6:29).
Jesus defines righteous faith/belief such that a person believing in Jesus whom the Father has sent is the work of God (John 6:29).
Jesus attributes a complete package, a whole gift, a finished work which He refers to as "that you believe in Him whom He has sent".
God deposits "that you believe in Him whom He has sent" in a person as a complete, sufficiently functioning work by God unto salvation of the person with nothing additional by the person as necessary, no choice by the person, no work of a decision by the person, no acceptance by the person, nothing by the person to achieve salvation.
So, "that you believe in Him whom He has sent" is a complete thing with nothing more to add by the person to the righteous faith/belief deposited by God unto being saved from the wrath of God.
Jesus clearly explains that the "believe in Him whom He has sent" is locked inside of the "you" specified by Jesus (John 6:29).
This "locking" is "the work of God" for God secures all of God's own persons unto eternal life (John 10:27-29).
The whole pagkage is done, finished, and complete.
There is nothing more "to be done" by the "you" with the finished package in order to obtain the gift of eternal life in God.
Thus, the only persons with righteous faith/belief implanted by God for a person's salvation are in the population of persons with eternal life in God (John 6:29, John 3:16).
The Word of God conclusively proves that the context establishes the "world" as the population of God's chosen persons ONLY.
When self-will persons (2 Peter 2:9-10) define the "world" in John 3:16 as everyone everywhere without exception, then such persons assert that the Truth (Jesus - John 14:6) tells a lie. The deception results because such persons have Jesus losing persons eternally in spite of Him saying "I give eternal life to them, and they will never perish; and no one will snatch them out of My hand" (John 10:28).
The "no one" in "no one will snatch them out of My hand" means no one, not the devil, not the person himself or herself, not another person. The "no one" means absolutely NO ONE.
If the word "world" in John 3:16 includes the population of persons who die while in disbelief/unfaith, then God lost some persons to eternal punishment instead of eternal life.
Since believing in the Son of God whom God the Father has sent is the work of God (John 6:29) and no one will snatch a God rooted believer out of Jesus' hand (John 10:28), then the population of persons represented by the word "world" by Jesus as recorded by the Apostle John (John 3:16) must of necessity be only persons who currently believe in Jesus or will in the future believe in Jesus unto eternal life in God.
The Word of God conclusively proves that the context establishes the "world" as the population of believers, God's chosen persons, existing or yet to be ONLY.
The word "world" in John 3:16 is the population of persons currently are or in the future to be imparted the work of God unto salvation that is faith/belief in Lord Jesus Christ whom the Father has sent (John 6:29).
The Apostle John wrote "He Himself is the propitiation for our sins; and not for ours only, but also for [those of] the whole world" (1 John 2:2).
The Apostle John also wrote "the whole world lies in the evil one" (1 John 5:19).
Notice "the whole world" occurs twice in the same book with the same author.
Since free-will supporting persons (2 Peter 2:9-10) say "the whole world" in 1 John 2:2 means every person everywhere can choose salvation, then such persons interpretation of "the whole world" has such free-will supporting persons themselves as part of "the whole world" lying in the evil one per 1 John 5:19.
The Apostle John further wrote "you have overcome the evil one" (1 John 2:13), and John uses the "you" to refer to Christians exclusively; therefore, no Christian lies in the evil one.
Because John wrote "you have overcome the evil one" (1 John 2:13), then this means Christians are beyond the evil one; therefore, no Christian lies in the evil one.
This means that "the whole world" in 1 John 5:19 does not include the children of God for we are Christians.
This means that "the whole world" in 1 John 5:19 does not include every person everywhere because Christians are not included.
This means that free-will supporting persons have not overcome the evil one since such free-will supporting persons include themselves in "the whole world" thus including themselves as lying in the evil one.
The "lies" or "lying" in the evil one is similar to "abides" or "abiding" in the evil one, so there is a tight relationship between such free-will supporting persons and the evil one.
The English word "lies" in 1 John 2:2 derives from the Greek word "κεῖται" (Strong's 2749 - keimai - to be laid, lie) which specifically means "lay".
This means that free-will supporting persons are not Christians, and it is the free-will supporting persons definition of "world" that effectually makes such free-will supporting persons Non-Christians, that is, unbelievers.
This also means the word "world" does not have to mean every person everywhere when the word "world" is used in the Bible.
These two different meanings for the word "world", "the whole world", occur in one book of the New Testament.
It is time to return to 1 John 2:2.
The word "world" in 1 John 2:2 is the population of persons who are yet to be imparted the work of God that is faith/belief in Lord Jesus Christ whom the Father has sent (John 6:29).
The word "world" in 1 John 5:19 is the population of persons who have NOT been imparted the work of God that is faith/belief in Lord Jesus Christ whom the Father has sent (John 6:29), and this population of persons includes persons that will not be imparted faith/belief before such persons die.
Behold, the two different populations of persons represented by "world" in the Book of the First Letter of John (1 John).
The word "world" has four different meanings in the above passages.
The word "world" does not of necessity need to be defined as "all the people that are in it".
The word "world" in the New Testament Books is generally defined by the context around the word.