2 Samuel 5-7 (The Daily Walk Bible).
Why did Uzzah die? Well, it was really Davids fault. The ark was not supposed to be carried that way. It was supposed to be carried on poles on the shoulders of the Levites (Numbers 7:9). Instead, David put it on a cart, the oxen stumbled, and Uzzah paid the price. It becomes a reminder to David of the need for obedience and the trustworthiness of God, since the Levites were warned not to touch the holy things or they would die (Numbers 4:15).
As far a David building the temple is concerned, we have the rest of the story in 1 Chronicles 22:7-10. “David said to Solomon, ‘My son, I had it in my heart to build a house to the name of the LORD my God. But the word of the LORD came to me, saying, “You have shed much blood and have waged great wars. You shall not build a house to my name, because you have shed so much blood before me on the earth. Behold, a son shall be born to you who shall be a man of rest. I will give him rest from all his surrounding enemies. For his name shall be Solomon, and I will give peace and quiet to Israel in his days. He shall build a house for my name. He shall be my son, and I will be his father, and I will establish his royal throne in Israel forever.”’”
Why did it matter? Wasn’t David doing what God wanted him to do when he was engaging in warfare? Why would that keep him from building the temple? Some speculate that it was because of his occasional brutality (2 Samuel 8:2). Could it simply be that, since the temple is to be considered a “house of prayer for all nations” (Mark 11:17), it was better to associate it with Solomon (whose name is similar to the Hebrew name for “peace”) than with David, who was every inch a warrior. Was God emphasizing something about His nature by having Solomon build it?