First lets define both of them.
- ṣalla llāhu ʿalay-hi wa-alehe-wa-sallam
means you're praying to Allah saying "may Allah honour him and grant him peace"
- ʿalayhi as-salām
means simply "peace be upon him".
There is verse in Qur'an which specifically says "peace be on the Messengers!" (Qur'an 37:181), from which it is generally implied that whenever we address the name of any prophet, we say, "peace be upon him" or in Arabic "ʿalayhi as-salām". (Read more...)
But it is different when we address Prophet Muhammad where we're supposed to say (1) "may Allah honour him and grant him peace". This is usually what called Durood.
There are different variations of Durood. In salah, we recite the so called famous "Durood - E- Ibrahim"
One more place just before Durood - E _Ibrahim, we say "Shahada" as...
- I testify that (there is) no god except God; One is He, no partner has He, and I testify that Muhammad is His servant and messenger
or in Arabic is "Ašhadu an lā ilāha illā-llāh waḥdahu lā šarīka lahu, wa ašhadu anna muḥammadan ʿabduhu wa rasūluhu."
So, right after hearing the name of Prophet Muhammmad, we don't say here "ṣalla llāhu ʿalay-hi wa-alehe-wa-sallam" (1) which is a smaller form of Durood, but we instead ask Allah in detail to bless Prophet Muhammad and his family by reading Durood - E - Ibrahim. which reads...
- O Allah, let Your Peace come upon Muhammad and the family and followers of Muhammad, as you have brought peace to Ibrahim and his family. Truly, You are Praiseworthy and Glorious. Allah, bless Muhammad and the family and followers of Muhammad, as you have blessed Ibrahim and his family and followers. Truly, You are Praiseworthy and Glorious".
The above are the common places in Salah (prayer) where we encounter the saying of the name of Prophet Muhammad.
May the creator guide us all.