Instead of obeying God's instructions with respect, Moses criticized the people (Must we bring you water out of this rock?). Moses then hit the rock twice with his staff (20:11). God considered the words and actions of Moses as a serious lack of faith. Moses "spoke rashly" (Psalm 106:32–33; compare James 1:20). Moses did not trust God enough to show God’s holiness to the people.
God had told Moses exactly what to do. By acting differently, Moses showed a lack of faith that God would provide for his people. His angry words also revealed this lack of trust.
The Lord requires obedience and faith. Anything less dishonors his holy character (Numbers 20:24; 27:14). Such a serious lack of obedience and faith led to the same outcome as earlier (14:20–23; see also 1 Corinthians 10:4–12).