Is It Permissible to Say Ya Muhammad (O Muhammad)?
Question

Can we say like Ya Muhammad to our Prophet Muhammad (peace and blessings of Allah be upon him)?
Praise be to Allah.Did the Companions address the Prophet by saying Ya Muhammad?
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 (interpretation of the meaning): 
“Make not the calling of the Messenger (Muhammad ) among you as your calling one of another” [al-Nur 24:63] 
Al-Dahhak said, narrating from Ibn 'Abbas: 
“They used to say Ya Muhammad , Ya Aba’l-Qasim, but Allah told them not to do that, out of respect to His Prophet (peace and blessings of Allah be upon him). So they said Ya Rasul Allah (O Messenger of Allah), Ya Nabi Allah (O Prophet of Allah). Mujahid and Sa’id ibn Jubayr said something similar.”  
Qatadah said: 
“Allah enjoined that His Prophet (peace and blessings of Allah be upon him) should be treated with respect and venerated and honoured as a leader.” 
Muqatil ibn Hayyan said: “Do not address him by name when you call him and say Ya Muhammad, and do not say Ya Ibn ‘Abd-Allah. Rather address him with honour and say Ya Nabi Allah or Ya Rasul Allah.” 
Malik said, narrating from Zayd ibn Aslam: “Allah enjoined them to address him with honour.” 
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. 
Can we say Ya Muhammad?
It is not permissible to call on the Prophet (peace and blessings of Allah 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 (interpretation of the meaning): 
“And the mosques are for Allah (Alone), so invoke not anyone along with Allah” [al-Jinn 72:18] 
“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-Ahqaf 46:5] 
And the Prophet (peace and blessings of Allah 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.” (Narrated by al-Tirmidhi (2516) and classed as sahih by al-Albani in Sahih Sunan al-Tirmidhi) 
Du`a is asking for benefit and asking for harm to be warded off, and it is not only done by saying Ya (O…), 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. 
This is the action of monotheists (believers in Tawhid) who do not call upon anyone other than Allah. As for those who worship graves and tombs, they call upon their “saints” and revered ones, saying Ya Badawi, Ya Rifa’i, Ya Jilani, and what they mean is, O Badawi, help us, come to our aid, save us. 
And some of them say: Ya Rasul-Allah, Ya Muhammad , in this manner also. This is calling upon him, seeking his help and turning to him. 
It is well known that this is one of the worst ways of going against the message that was brought by Muhammad (peace and blessings of Allah be upon him) and the other Messengers, and that was revealed in the Books, namely the call to Tawhid and worshipping Allah Alone, and forsaking the worship of all others. 
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 (interpretation of the meaning): 
“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 ilah (god) with Allah? Little is that you remember!” [al-Naml 27:62] 
Can you say Ya Muhammad or Ya Rasul Allah but you don’t intend calling upon the Prophet?
Thus it is known that 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 mind and 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 manners, as explained above. 
Shaykh Ibn Baz (may Allah have mercy on him) was asked: Is it shirk if someone says in any place on earth, Ya Muhammad Ya Rasul-Allah, calling him? 
He replied: 
“Allah has stated in His Noble Book and on the lips of His Messenger (peace and blessings of Allah be upon him) that worship is the right of Allah Alone and no one else has any share of it, and that du`a is a kind of worship, so if a person says in any place on earth, 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 making him a partner with Allah in worship. 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, because Allah says (interpretation of the meaning): 
“And I (Allah) created not the jinn and mankind except that they should worship Me (Alone)” [al-Dhariyat 51:56] 
“O mankind! Worship your Lord (Allah), Who created you and those who were before you so that you may become Al-Muttaqun (the pious” [al-Baqarah 2:21]” (Majmu’ Fatawa al-Shaykh Ibn Baz (2/453) 
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked: Some people at times of hardship say Ya Muhammad or Ya ‘Ali or Ya Jilani. What is the ruling on that? 
He replied: 
“If the intention is to call upon them and seek their help, then the person is a mushrik in the sense of major shirk that puts one beyond the pale of Islam, and he must repent to Allah and call upon Allah Alone, as Allah says (interpretation of the meaning):  
“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 ilah (god) with Allah? Little is that you remember!”  [al-Naml 27:62] 
As well as being a mushrik, he is also fooling himself. Allah says (interpretation of the meaning): 
“And who turns away from the religion of Ibrahim (Abraham) (i.e. Islamic Monotheism) except him who befools himself?” [al-Baqarah 2:130] 
“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-Ahqaf 46:5] (Fatawa al-Shaykh Ibn ‘Uthaymin, 2/133)
And Allah knows best.