This command is also a promise. Hashem promises that He will examine the prophets, and if He sees that they won’t tell the truth, He will not allow them to prophesize in the first place. Those who do prophesize will only be the ones who will speak the Word of Hashem in absolute truth and honesty.
In other words, when Hashem commanded us to listen to the prophets, this is a promise that the prophets will be reliable, and when we embrace the words of the prophets, it is not because we know the prophets to be godly and infallible. Indeed, they were tremendously perfected and uplifted human beings. Nevertheless, we want to receive the Torah from Hashem. To that end, Hashem promised that the Torah will be transmitted to us in a true and accurate manner.
This applies to Moshe Rabbeinu as well. Moshe wrote in the Torah, in Hashem’s name, that tefillin need to contain certain specific passages written on parchment, and he also transmitted to us that the tefillin need to be black and square. And that a mezuzah needs to fulfill such and such requirements. And that the other mitzvos need to be done according their specific halachos as stated.
Is Moshe Rabbeinu capable of speaking falsehood? Definitely. Because if not, he is not a human being, but a machine. So how can we know that he spoke the truth? Because Hashem promised us, וגם בך יאמינו לעולם – “They will believe also in you, [Moshe,] forever.”
Hashem declared that we may trust Moshe Rabbeinu like we trust Hashem, because everything Moshe Rabbeinu will say is 100% correct.
Once in history, it happened that Moshe Rabbeinu acted like a human being when transmitting Hashem’s Torah. Moshe got angry, like a human being, and this anger did not accurately reflect the word of Hashem. As a result, Moshe forfeited his role as the leader of the Jewish people. It was decreed that he will not bring the people into Eretz Yisrael.
This was Moshe’s sin at the rock, according to the Rambam’s approach.
