The bible teaches us that the “whole” person has three components: spirit, soul and body (1 Thessalonians 5:23b; ISV)
And may your whole being—spirit, soul, and body—remain blameless when our Lord Jesus, the Messiah, appears.
It’s obvious that when a person dies, the body decays. The bible also talks about how the dead person’s “dust returns to the ground it came from” (Ecclesiastes 12:7, NIV).
Interestingly, that same verse also teaches us that the person’s “spirit returns to God who gave it” (Ecclesiastes 12:7, NIV).
Why does God give each person a spirit? This is so that he/she may “understand”, in particular, to the reality of God (Job 32:8, ESV):
But it is the spirit in man, the breath of the Almighty, that makes him understand.
Indeed, it is precisely because a person is equipped with this ability to understand (because of the spirit given to him/her), that he/she has no excuse for not believing in God (Romans 1:20; NIV; emphasis mine):
For since the creation of the world God’s invisible qualities–his eternal power and divine nature–have been clearly seen, being understood from what has been made, so that people are without excuse.
To reiterate, upon death a person’s body decays, and his/her spirit is returned to God (Ecclesiastes 12:7, NIV). However, the person’s soul remains conscious, and ends up in either one of two places depending on the choices that the person has made during his/her lifetime.