It was not permissible to address the Prophet (peace and blessings of Allah be upon him) by saying “Ya Muhammad” during his lifetime, because Allah says “Make not the calling of the Messenger among you as your calling one of another” [al-Noor 24:63].
So the Prophet (peace and blessings of Allah be upon him) should not be addressed by name only, rather it should be said: Ya Rasul Allah, Ya Nabi Allah.
Moreover, it is not permissible to call on the Prophet (peace and blessings be upon him) in du’a’ after his death, because du’a is an act of worship that can only be directed to Allah. Allah says: “And the mosques are for Allah (Alone), so invoke not anyone along with Allah” [al-Jinn 72:13] and He says: “And who is more astray than one who calls on (invokes) besides Allah, such as will not answer him till the Day of Resurrection, and who are (even) unaware of their calls (invocations) to them?” [al-Ahqaaf 46:5]
The Prophet (peace and blessings be upon him) said to Ibn ‘Abbas (may Allah be pleased with him): “If you ask, then ask of Allah, and if you seek help then seek help from Allah.” (al-Tirmidhi).
Du’a is asking for benefit to be gained and asking for harm to be warded off. It is not done by merely saying Ya (O…), but rather it has become customary among people to use this call in du’a, especially when hardship comes and calamity strikes, so they say Ya Allah, meaning O Allah, save us, give us help, support us. Accordingly, saying: Ya Rasul-Allah, Ya Muhammad, in this manner is calling upon him, seeking his help from him and turning to him.
It is not acceptable in the religion of Islam, which Allah has chosen as the religion for His slaves, to call upon anyone except Allah, not any Prophet who was sent or any angel who is close to Him. Rather we are to call upon Him alone. Hence Allah says:
“Is not He (better than your gods) Who responds to the distressed one, when he calls on Him, and Who removes the evil, and makes you inheritors of the earth, generations after generations? Is there any god with Allah? Little is that you remember!” [al-Naml 27:62]
Thus, if a person says Ya Muhammad or Ya Rasul Allah, not intending thereby to call upon him and seek his help, then there is nothing wrong with it, such as if he wants to call him to his mind and to remember him, such as if he reads a hadith and says Sall-Allah ‘alayka ya Rasul-Allah (May Allah send blessings upon you, O Messenger of Allah) or How great and beautiful are your words, O Messenger of Allah. But saying Ya Muhammad is contrary to good etiquettes, as explained above. But if he intends Ya Rasul-Allah, Ya Nabi Allah or Ya Muhammad, help me, or save me, or support me, or heal me, or support your ummah, or heal the sick Muslims, and guide their misguided ones and so on, then he is doing wrong.
The same applies to those who do the same thing with regard to other Prophets, angels, awliya’ (“saints), jinn, idols or any other created beings.
The Prophet (peace and blessings be upon him) explicitly warned his Ummah against exaggeration in praising him as the Christians did with Jesus (peace be upon him) and ended up worshipping him.“