Hebrews 4:12 says “For the word of God is living and active and sharper than any two-edged sword, and piercing as far as the division of soul and spirit, of both joints and marrow, and able to judge the thoughts and intentions of the heart.”
The term "word of God" may mean a word spoken by God without a human mouthpiece. But in the New Testament it regularly means a word or a message that a human speaks on God's behalf.
Hebrews 13:7 says, "Remember those who led you, who spoke the word of God to you; and considering the result of their conduct, imitate their faith." So the "word of God" in Hebrews 4:12 most likely refers to the truth of God revealed in Scripture that people speak to each other with reliance on God's help to understand it and apply it.
The word of God is not a dead word but a powerful word. It has life in it. And because it has life in it, it produces effects. There is something about the Truth, as God has revealed it that connects it to God as a source of all life and power. He upholds this universe with His mighty word of power. God loves his word. He is partial to his word. He honors his word with his presence and power. If you want your teaching or witness to have power and produce effects, stay close to the revealed word of God.
What does this living and effective word accomplish? It pierces for what purpose? The answer is, to divide soul and spirit.
The writer gives an analogy: it's like dividing joints and marrow. Joints are the thick, hard, outer part of the bone. Marrow is the soft, tender, living, inner part of the bone. That is an analogy of "soul and spirit." The word of God is like a sword that is sharp enough to cut right through the outer, hard, tough part of a bone to the inner, soft, living part of the bone. Some swords, less sharp, may strike a bone and glance off and not penetrate. Some swords may penetrate part way through the tough, thick joint of a bone. But a very sharp, powerful double-edged sword will penetrate the joint all the way to the marrow.
"Soul and spirit" are like "bone joint and bone marrow." "Soul" is that unseen dimension of our life that we are by nature. "Spirit" is what we are by supernatural rebirth. Jesus said, "That which is born of the flesh is flesh, and that which is born of the Spirit is spirit" (John 3:6). Without the awakening, regenerating work of the Spirit of God in us we are merely "natural" rather than "spiritual" (1 Corinthians 2:14-15). So the "spirit" is that unseen dimension of our life that we are by the regenerating work of the Spirit.
What is the point in saying that the "word of God" pierces to the "division of soul and spirit"? The point is that it's the word of God that reveals to us our true selves. Are we spiritual or are we natural? Are we born of God and spiritually alive, or are we deceiving ourselves and spiritually dead? Are the "thoughts and intentions of our heart" spiritual thoughts and intentions or only natural thoughts and intentions. Only the "word of God" can "judge the thoughts and intentions of the heart" as Hebrews 4:12 says.
The word of God pierces deep enough to show us the truth of our thoughts and our motives. Give yourselves to the word of God in the scriptures. It is through God’s word that we confirm not only our regeneration, but also our justification and glorification.