49 And David put his hand in his bag and took out a stone and slung it and struck the Philistine on his forehead. The stone sank into his forehead, and he fell on his face to the ground. 50 So David prevailed over the Philistine with a sling and with a stone, and struck the Philistine and killed him. There was no sword in the hand of David. 51 Then David ran and stood over the Philistine and took his sword and drew it out of its sheath and killed him and cut off his head with it. When the Philistines saw that their champion was dead, they fled.
-1 Samuel 17:49-51
"This passage says David killed Goliath twice: once with a sling and once with a sword."
Although the wording in this passage is confusing, it doesn’t say David killed Goliath twice. When read carefully, it’s evident that the passage says David knocked down Goliath with a stone, then finished him off with a sword.
Verse 49 tells us that David knocked down Goliath by striking him with a stone. Verse 50 reiterates by saying "So David prevailed over the Philistine with a sling and stone.". However, it gives us additional information that David not only prevailed over the Philistine with the sling and stone, he also struck and killed him ("...AND struck the Philistine and killed him"). The rest of the verse, along with verse 51, elaborate on how David "struck and killed" the fallen Philistine. It starts by telling us David didn’t have a sword, then verse 51 continues where verse 49 left off: "Then David ran and stood over the Philistine and took his sword and drew it out of its sheath and killed him and cut off his head with it.".
We should be skeptical that the author of 1 Samuel would write two obvious, contradictory accounts in the span of 2 sentences. Even if he were trying to deceive us, it’s unlikely that he’d write the first account, completely forget what he wrote, then write a completely different one in the very next sentence. Furthermore, he’d have to fail to proofread his work, then the conspirators who assembled the Bible would have to miss it as well.