That the word “killed” or “slew” (KJV) appears in both verse 50 and 51 should not cause the reader to be confused about what was responsible for Goliath’s death. He was killed by the stone which came from David’s sling, as indicated in verse 50. After killing the giant, David stood over him, and used his own sword to cut off his head. The taking of Goliath’s head was not the point of his death, but immediately followed his death. David, “...slew him, and cut off his head...”
There is no contradiction.
When we were kids in Sunday School, this was such a nice story about a little guy killing a giant. Good thing they never told us about, or showed us a picture of, David standing there holding the giant’s bloody head. Ha! Go, David!!!!
Maybe Goliath received a mortal wound from the stone and was unconscious. Thus the stome could be said to have slain him. then David hurried the job along with the sword??