The sentence here in Greek is very simple:
John 4:24 God is spirit (πνεῦμα ὁ θεός)
So, without the need for ‘a’ to be added as the KJV does, best reads:
“God is spirit, and those who worship him must worship in spirit and truth.” (John 4:24 ESV)
Compare two similar God is statements in 1 John 4.
1 John 4:8 God is love (ὁ θεὸς ἀγάπη ἐστίν)
1 John 4:16 God is love. (Ὁ θεὸς ἀγάπη ἐστίν)
We wouldn’t say “God is a love”, love unlike spirit in not countable in Greek or English. The reading “God is a spirit” originates in the Wycliffe Bible circa 1382, and so predates the King James Version.
24 God is a Spirit, and it behooveth them that worship him, to worship in spirit and truth. (John 4:24 Wycliffe Bible)
But all the same the context, in spirit and truth – which are both to be read as qualities, uncountable nouns, not in a spirit and in truth makes the natural reading that God is spirit is correct. The argument in 1 John 4 is parallel, God is love so Christians should have love. In John 4:23 God is spirit (as a quality, not a spirit) so Christians should worship in that quality, spirit, and truth.