David was king over all Israel, and moreover had established Jerusalem as the capital of his kingdom. The ark of the covenant had not dwelt in the Holy of Holies since the days of the sons of Eli the priest, when they took it out to battle and the Philistines captured it.
It is not that the box itself was so holy – the box was the natural representation of heavenly and spiritual realities. But the manifest presence of YHVH dwelt between the golden cherubim on its lid, among Israel (1 Chr 13:6). It is YHVH and His presence that is holy.
So they began carrying the ark up to Jerusalem, but not in the prescribed manner. Whenever the ark was to be moved, the priests were to wrap it in a very specific manner, and no one was to even look on it, lest they die. Then certain Levites were to carry it via poles on their shoulders, for the Levites were consecrated for this work. They were called out and appointed to it by the command of YHVH.
When a non- Levite touched the ark, he died; and David stopped bringing the ark to Jerusalem. The man who died, was an Israelite, a worshiper of YHVH. He was probably a good person. But he transgressed the holiness of YHVH.
God was very careful to establish His holiness and His reverence in the hearts and minds of Israel during the wilderness journey from Egypt. Many died who would not regard Him or His word, as He sought to impress upon them that He was not like the Egyptian idols or pagan idols, and His ways were not like their ways, and things must be different with Him than what they had been used to with them. But I think during the days of Eli the priest, the holiness of YHVH was regularly transgressed, if his sons treated the sacrifices and their offices in the manner described in 1 Sam 2:12-17. So out of that light regard, came Saul’s 90% obedience to the commandments of YHVH. First His worship is esteemed lightly, then His Word is esteemed lightly – and before you know it, His Torah, His ways of righteousness, are being transgressed, and injustice increases in the land, and His people begin experiencing disease and lack and defeat, when the blessing of YHVH no longer rests upon them.
I believe that God takes no pleasure in killing any of His worshipers, as He did with Uzza, and as He did with Ananias and Sapphira (Act 5:1-11). But it is an act of love for Him to establish respect, reverence, and regard for His presence and His holiness and His word among His people, so that His blessing can rest upon His people. David feared the LORD when the LORD broke out against Uzza. And that fear, which God established in David at the beginning of His kingdom, served to mostly protect him and by extension, all Israel, from the harm which comes upon a man and a nation when His word and His Torah is lightly esteemed and transgressed.
It is better for us to learn by instruction than by consequences! Uzza learned by consequences. Ananias and Sapphira learned by consequences. Let us learn by instruction, and fear and reverence the holiness and presence of YHVH our God!