Prov 3:5 KJV Trust in the Lord with all thine heart, and lean not unto thine own understanding.

After becoming the king of all Israel, David decided to bring the ark of the covenant in the land of the Philistines back to Israel. 
2 Samuel 6:2-3 KJV
[2] And David arose, and went with all the people that were with him from Baale of Judah, to bring up from thence the ark of God, whose name is called by the name of the Lord of hosts that dwelleth between the cherubims. [3] And they set the ark of God upon a new cart, and brought it out of the house of Abinadab that was in Gibeah: and Uzzah and Ahio, the sons of Abinadab, drave the new cart.

David again brought together 30,000 chosen men out of Israel. They set the ark on a new cart and brought it from the house of Abinadab. David and the whole house of Israel were celebrating with all their might before the Lord with songs and with harps, lyres, tambourines, sistrums, and cymbals.
They were returning the ark to its rightful place when tragedy struck.
2 Samuel 6:6-7 AMPC
[6] And when they came to Nacon’s threshing floor, Uzzah put out his hand to the ark of God and took hold of it, for the oxen stumbled and shook it. [7] And the anger of the Lord was kindled against Uzzah, and God smote him there for touching the ark, and he died there by the ark of God.
Uzzah reached out his hand and took hold of the ark of God because the oxen stumbled. The Lord’s anger burned against Uzzah for his irreverent act; therefore God struck him down and he died beside the ark of God.

Question is why would God have struck down a man who was trying to serve his king and God?

David and his men had leaned on their own understanding.
They brought the ark upon an ox cart, which is just how the philistines had done it. As Paul wrote in Romans 10:2 “They are zealous for God, but their zeal is not based on knowledge “
The will of God was plainly revealed: the ark was to be covered, staves were to be inserted in the rings in its ends, and it was to be carried on the shoulders of the Kohathites.
Nothing has been said about placing it on a “new cart” that was a humane invention, and contrary to the instructions of the Lord. David’s desire was holy, his motive was pure, but he went about it the wrong way.
You are not free to serve God the way you chose to serve Him. To please Him you must do it His way and according to his word.

See where you are leaning on your own understanding, and repent today. Then determine, with God’s help, to trust in His ways in all that you do.
God’s primary concern is not results, but obedience.
God cares more about being quoted properly and having his Word applied correctly than about immediate effectiveness.
and lean not unto your own understanding; or trust not to that; for it stands opposed to trusting in the Lord.

Men should not depend upon their own wisdom and understanding, in the conduct of civil life, but should seek the direction and blessing of Providence, or otherwise will meet with a disappointment;
a natural man has no understanding of spiritual things, of the things of the Gospel, nor indeed any practical understanding of things moral, Romans 3:11 KJV
[11] There is none that understandeth, there is none that seeketh after God.
Jeremiah 4:22 AMPC
[22] [Their chastisement will continue until it has accomplished its purpose] for My people are stupid, says the Lord [replying to Jeremiah]; they do not know and understand Me. They are thick-headed children, and they have no understanding. They are wise to do evil, but to do good they have no knowledge [and know not how].

The understanding of man is darkened by sin; yea is darkness itself; it is like the first earth, covered with darkness, till light is let into it, and therefore not to be leaned unto and depended on, Ephesians 4:18 AMPC
[18] Their moral understanding is darkened and their reasoning is beclouded. [They are] alienated (estranged, self-banished) from the life of God [with no share in it; this is] because of the ignorance (the want of knowledge and perception, the willful blindness) that is deep-seated in them, due to their hardness of heart [to the in-sensitiveness of their moral nature].

There is a necessity of a new heart and spirit, of an understanding to be given, in order to understand spiritual and divine things,

Ezekiel 36:26; for though these are not contrary to the reason and understanding of men; yet they are above them, and cannot be discovered, reached, comprehended, and accounted for by them, Matthew 16:17. Nay, there are some things in the Gospel, which, though plain to an enlightened understanding by the word of God, yet the manner how they are cannot be apprehended: as the doctrines of a trinity of Persons; of the generation of the Son of God; the procession of the Spirit; the union of the two natures in Christ; the resurrection of the dead.

but the word of God only is our rule of judgment and the standard of our faith and practice, and to that, we should have recourse and be directed by it, and not lean to our own understandings.
It’s about God’s word, it’s in the details. According to Heavenly pattern. Thy will be done on earth as it is in Heaven.

Heavenly father wherever I have not trusted in you wholeheartedly, wherever I have leaned on my own understanding, I repent today, have mercy, let your mercy prevail over judgment. Create in me a pure heart Oh Lord and renew a steadfast spirit within me. Do not cast me from your presence or take your holy spirit from me. Restore to me the joy of your salvation and grant me a willing spirit to sustain me. then I will teach transgressors your ways, and sinners will turn back to you. 
Thank you for making me a new creation in Christ, old things are passed away; behold all things become new. I promise to acknowledge you in all my ways so you can direct my path.