All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
As for the physical appearance of the Prophet Mohammad he was described in a Hadeeth to be of medium height, neither short nor tall. Rabee'ah Ibn Abu 'Abdur-Rahmaan said: "I heard Anas Ibn Maalik describing the Prophet saying: "The Prophet was of medium height amongst the people, neither short nor tall..." [Al-Bukhari]
As regards what you mentioned about the description of the Prophet that his height used to increase to the extent that he would become taller whenever he meets someone taller than him, then the following narration illustrates this point.
Ibn Abu Khaythamah reported, through Al-Bayhaqi and Ibn 'Asaaker that 'Aa'ishah said: "Whenever a tall man happened to walk beside the Prophet but the Prophet would be taller than him. Sometimes, he was surrounded by two tall men but the Prophet exceeded them (in height). Yet, when he was seen alone, he was said to be of medium height."
This description of the Prophet was mentioned by many of the authors of the Prophet's biography. Yet, the Hadeeth mentioned above is not authentic to validate what this person said because there is Subayh Ibn 'Abdullaah, a weak narrator, and one of the scholars who taught Ibn Khaythamah in the chain of narrators of this Hadeeth and he was described by Al-Khateeb in his book 'Al-Talkhees' (the summary) to be one who narrates Ahadeeth that contradict authentic ones.
He was also described as such by 'Abdul-Ghani Al-Masri.
Allaah Knows best.