and the sword of the Spirit, which is the word of God Ephesians 6:17 (NKJV)
The number one purpose of the Sword of the Spirit which is the Word of God is right judgement.
Just as the physical sword can cut through physical matter and make a separation the Spiritual Sword cuts through spiritual matters and makes a separation.
It’s the Word that is able to separate or distinguish spirit from soul and body. Hebrews 4:12. In other words it’s the Word that can help us rightly discern the things of the spirit, the mind and the body.
For instance I can tell that a certain thought, idea, plan, purpose is from the Spirit or soul; it’s from God or my human imagination or even satan, by finding out if it’s in line with the Written Word of God or not.
In His temptation in the wilderness Jesus did spiritual warfare and overcame using the Sword of the Spirit aka Word of God by countering the devil with “it is written” Matthew 4:3-10. In verse 11 the defeated devil left Jesus and angels ministered to Him.