Moshe's leadership of the Jews in the wilderness is bookended by two incidents, that in Parshas Beshalach after the Jews have left Egypt when the people clamor for water and toward the end of their journey through the wilderness in Parshas Chukas where once again the people clamor for water.
What does water represent? Life. While people can survive for a time without food, they cannot live at all without water. Especially in a desert. Food is therefore livelihood and the manna represented explicitly livelihood, which is why it was not harvested on the Shabbat. But no such stipulation was made for the well. People always need water. Water is life.
The journey through the wilderness was a journey of faith. By depending on G-d for their life and their livelihood, their water and their food, they were meant to learn faith. Demanding water from Moshe both times demonstrated a lack of faith.
In Parshas Beshalach, we are told that they journeyed Al Pi Hashem, on the word of G-d. And so when they demand water, Moshe berates them for testing G-d. But in Parshas Chukas, there is no mention of G-d in their arrival. Yet when the people demand water, they call themselves Kahal Hashem, the congregation of G-d. After all these years, the people had come to see themselves not as a mob, but as a Godly congregation. So while both times it says Vayarev Ha'am, but in Chukas it says VaYekahalu, which means that they assembled as an assembly.
And so in these two times, G-d calls on Moshe to carry out two similar but different miracles, based on the context. The first He tells Moshe to strike the rock. The second time to speak to it.
What is the difference? To strike a rock is a wonder, similar to those that Moshe performed for the children of Israel. And a wonder has to be performed for people who lack faith and need a visible show that G-d is powerful and that Moshe is his servant. This is the Mofait or the wonder. But toward the end of their journey, the people of Israel had become elevated enough that they did not need a wonder in order to believe in G-d, they needed a sign that their journey was still being done Al Pi Hashem. Through the word of G-d.
And so G-d told Moshe to speak to the rock with the Pi Hashem, not to strike it. But Moshe was angered, and called the people of Israel rebels, treating them as if they lacked the faith for a sign and deserved nothing more than a wonder, and struck the rock instead.
When G-d reproves Moshe, He says, "Lo Heemantem Bi", not that the people of Israel did not believe in me, but you did not believe in me.
We are told that the first incident took place in Midbar Sin, the sin desert, while the second incident took place in Midbar Tzin, the desert of Tzin. Samech and Tzaddek are only a few letters apart in the aleph bet. The numerical difference between them is 30. But Sin is spelled with a Yud adding another ten. And so the difference between them is twenty or chaf.
Add the Chaf to Sin and you end up with Pe or Pi, the mouth of G-d. The difference between the two incidents was that the people needed the Word of G-d, not to be struck with a staff.
Both places are named after strife. Rephidim and Mei Meriva both suggest conflict. But there's still a difference. Kadesh was the location, and though there was strife over the waters, the Mei Meriva, when the section is completed, we are told that the place name derives not from the waters, but from something else. VaYeKadesh Bam. Though the people of Israel were still lacking, G-d was still sanctified through them.
The difference between striking a rock and speaking to it may seem like a small thing, but it is the same as the difference between striking and speaking to a human being. It's easy to resort to the stick, but G-d is made holy through the word.