If the target player is an illegal target by the time Ukkima's last ability tries to resolve, the ability won't resolve. You won't gain any life.

Artwork
Loading artwork…
Ukkima, Stalking Shadow
Outlaws of Thunder Junction Commander · #247 · EN
Nonfoil—Foil—
Card rules
Partner with Cazur, Ruthless Stalker (When this creature enters, target player may put Cazur into their hand from their library, then shuffle.)
Ukkima can't be blocked.
When Ukkima leaves the battlefield, it deals X damage to target player and you gain X life, where X is its power.
2/2
Mythic · Illustrated by Daarken
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Use Ukkima's power as it last existed on the battlefield to determine how much damage it deals and how much life you gain. If that number is negative, it deals no damage and you gain no life.
If your life total is brought to 0 or less at the same time that Ukkima is dealt lethal damage, you lose the game before the last ability goes on the stack.