There exist the visible church and the invisible church.
The visible church consists of all who profess Christ as their savior.
Yet, Jesus states,
“Not everyone who says to me, ‘Lord, Lord,’ will enter the kingdom of heaven, but the one who does the will of my Father who is in heaven.” (Matt. 7:21)
Jesus also tells us what the Father wills:
“For this is the will of my Father, that everyone who looks on the Son and believes in him should have eternal life, and I will raise him up on the last day.” (John 6:40)
Professing to be a Christian does not necessarily mean that a person has been regenerated to new life by the Holy Spirit.
The invisible church consists of all who are regenerated to new life in Christ by the Spirit. Professing Christ does not mean one will endure to the end; having new life in Christ by the Spirit does mean one will endure to the end because the Spirit does not come and go depending on our level of faithfulness (Eph. 1:23-24). Once the Spirit has regenerated you and given you a new life, he keeps your life and preserves you forever.
The Westminster Confession of Faith, one of the great confessions of the historic church, states,
They, whom God hath accepted in His Beloved, effectually called, and sanctified by His Spirit, can neither totally nor finally fall away from the state of grace, but shall certainly persevere therein to the end, and be eternally saved. (Phil. 1:6, 2 Pet. 1:10, 1 John 3:9, 1 Pet. 1:5,9) — Westminster Confession of Faith 17.1
The invisible church consists of those throughout the ages who have new life in Christ, which will never be taken away from them.
Salvation is God’s gift entirely. Someone who has new life by the Holy Spirit cannot lose their salvation. All who endure to the end are those who are truly saved.
“But the one who endures to the end will be saved.” (Matt. 24:13)
The apostle John makes this very point when speaking of professing believers who have left the faith:
They went out from us, but they were not of us; for if they had been of us, they would have continued with us. But they went out, that it might become plain that they all are not of us. But you have been anointed by the Holy One, and you all have knowledge. (1 John 2:19-20)
Those who endure to the end are those who truly have new life—they are a new creation in Christ and are united to Christ. Professing Christians who are living the lifestyle of an unbeliever must examine themselves to see if they are truly in Christ for the sake of their eternal souls. Faithful church leaders will also care enough to exercise loving discipline when they see a wandering sheep, instead of just looking the other way.
Believers did nothing to earn regeneration and there is nothing they can do to become unregenerated. The Spirit indwells all true believers, and he convicts God’s children of their sin in his sanctifying work. No one will snatch Jesus’ sheep from his hand (John 10:28).
Reference
https://www.beautifulchristianlife.com/blog/visible-church-vs-invisible-church-whats-the-difference