السلام عليكم
According to Ghamidi Sahab, this is the difference between a نبى (prophet) and a رسول (messenger). Messengers are special prophets in that they are God’s final warning to an erring nation. Like the Quran says in Surah Yunus, verse 10:
ولكل امة رسول، فاذا جاء رسولهم قُضي بينهم بالقسط وهم لا يُظلمون
And for every people, there is a messenger–so, when their messenger arrives, the matter of the people is judged in all fairness and they are not wronged in the least.
That is, either these people thrive after acknowledging the message of the messengers like the people of Yunus عليه السلام or perish along with their egos like the people of Nuh عليه السلام.
For this mission, God provides messengers with protection special to them:
كتب الله لأغلبنّ أنا ورسلى
God has laid down that Me and My messengers will prevail (Surah Al-Mujadalah verse 21)
So, while Yahya and Zakariya عليهما السلام, both prophets, could be and were martyred, Isa عليه السلام, a messenger, could not and the Quran insists that the Jews were not able to martyr him:
وما قتلوه وما صلبوه
And they did not kill him and they did not crucify him (Surah Al-Nisa, verse 157)
I hope this helps.