The Height Is Not The Point
Read 1 Samuel 17 looking for what it is arguing and the measurement drops down the list quickly.
The chapter spends forty days on an army doing nothing. Saul, a head taller than every other Israelite and the obvious candidate, stays in his tent. The problem the writer is describing is not a large Philistine. It is a nation that has stopped believing anything about its own God.
“You come against me with sword and spear and javelin, but I come against you in the name of the Lord Almighty... and all those gathered here will know that it is not by sword or spear that the Lord saves.”
1 Samuel 17:45 and 47David's speech is not about courage and it is not about his own ability. It is an argument about who God is, delivered to an audience of Israelites who had forgotten. The Philistine is the occasion, not the subject.
One more note, since it comes up. The five smooth stones are often explained as one for Goliath and four for his brothers. 2 Samuel 21 does record other large Philistine warriors from Gath being killed later, but the Bible never calls them his brothers or connects the stones to them. It is a nice sermon and it is an inference.