The core tension is that a kohen is generally forbidden to contract corpse-tumah, yet Shulchan Arukh, Yoreh De'ah 336:1 and Arukh HaShulchan, Yoreh De'ah 336:1 establish that the Torah grants the physician permission—indeed an obligation—to heal, deriving this from the phrase 'ורפא ירפא' and treating failure to heal as tantamount to bloodshed, since saving life is a matter of pikuach nefesh.
Rav Eliezer Melamed (Peninei Halakhah, Likkutim I 11:7) frames the resulting machlokes directly: he reports that Rav Moshe Feinstein ruled that a kohen may neither study medicine nor work in a hospital, because both training and practice will repeatedly force him into contact with the dead, and since there are plenty of other Jews who can become doctors there is no need for kohanim specifically to take on that role, a position he says most poskim share; against this he notes that some poskim are lenient, reasoning that one cannot assume a corpse is present at any given moment, or that intact partitions may block the tumah from reaching the kohen's area, a leniency he attributes to the Tzitz Eliezer.
Igros Moshe YD 3:154 opens its discussion of kohanim studying medicine by stating plainly that it is simple and clear that a kohen is forbidden to become impure, setting the strict baseline from which the responsum proceeds.
Ma'ayan Omer (Maayan Omer 7:5:5) likewise rules that a kohen may not train as a doctor where that requires dissecting corpses or working in an emergency room where corpse-tumah is likely, though it cites opinions permitting leniency in cases of rabbinic-level or contained tumah, and it separately takes up whether gentile corpses convey tumah, permitting treatment of gentile patients under certain circumstances.
Tzitz Eliezer 16:33 takes up the practical hospital case directly, asking whether a kohen may serve where a deceased person may sometimes be present, given that he may need to remain to care for dangerously ill patients; and Tzitz Eliezer 4:4 and Tzitz Eliezer 17:8 extend this toward leniency, with the latter permitting a kohen to work as a nurse or aide even though a patient may die during his shift and he cannot necessarily leave at once, especially if he is qualified or needs the income.
Maayan Omer 7:5:8 rules on the closely related question of a kohen performing resuscitation, holding that he must continue even when the person appears dead, since the uncertainty as to whether life remains is enough to override the kohen's prohibition on tumah under the principle of pikuach nefesh.
The underlying halachic structure for overriding prohibitions to save life is laid out by Shulchan Arukh HaRav, Orach Chayim 328:2, which states that one who is scrupulous to override Shabbat for a case of danger is praiseworthy, and that even doubtful danger overrides Shabbat, since the Torah's 'וחי בהם' teaches that the mitzvot must not themselves bring a person to danger.
Separately, Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 128:79 addresses the kohen-physician case from another angle: a kohen doctor (like a kohen mohel) who through error causes a patient's death may still, after repentance, ascend the duchan and recite birkat kohanim, since his original intent was for a mitzvah.
Melammed Lehoil Part II 136:1-2 takes up a related practical scenario—a kohen hospital employee near a morgue in the garden—and reasons by analogy to the Rema's ruling on a city gate through which a corpse will eventually pass, concluding that where the stringent custom applies even to a gate, it certainly applies, a fortiori, to remaining near a hospital morgue, though where no such stringent custom prevails the case may differ.
Bekhorot 29a:6 and Yoma 84a:4-6 supply background for the broader values at stake—respectively, compensating a kohen who is rendered impure through communal service, and the Gemara's readiness to rely even on a non-Jewish healer's remedy to save Rabbi Yochanan—while Mishneh Torah, Defilement by Leprosy 9:1-2, Mishneh Torah, Defilement by Leprosy 10:1-2, Vayikra 13:2-3, and Mishnah Negaim 3:1 establish the kohen's unique role in pronouncing tumah and tahara for tzara'at, the very priestly function that underlies why contact with disease and impurity is bound up with the kohen's identity in the first place.