As related in BT Ketubot 104A (https://www.sefaria.org/Ketubot.104a.4?lang=bi) we are in fact permitted to pray for someone's death to come quickly if they are suffering, "The maidservant of Rabbi Yehuda HaNasi ascended to the roof and said: The upper realms are requesting the presence of Rabbi Yehuda HaNasi, and the lower realms are requesting the presence of Rabbi Yehuda HaNasi. May it be the will of God that the lower worlds should impose their will upon the upper worlds. However, when she saw how many times he would enter the bathroom and remove his phylacteries, and then exit and put them back on, and how he was suffering with his intestinal disease, she said: May it be the will of God that the upper worlds should impose their will upon the lower worlds.And the Sages, meanwhile, would not be silent, i.e., they would not refrain, from begging for mercy so that Rabbi Yehuda HaNasi would not die. So she took a jug [kuza] and threw it from the roof to the ground. Due to the sudden noise, the Sages were momentarily silent and refrained from begging for mercy, and Rabbi Yehuda HaNasi died."