If it’s in a Bounty, kite the undying mob a long away from your objective, teleport to town, then use the map teleport pads to go back to the map rather than going back via your town portal.
If it’s in a rift / GR and it’s preventing you getting your loot / gem upgrades, kite the mob to the exit to the next level, go down a level, teleport to town, go back in via the obelisk portal and run back to the guardian drops / Urshi.
If the bugged out “unkilllable” monster is part of the Cursed Chest event of the bounty, then you can’t finish the bounty until ALL mobs spawned by the chest are killed.