If one of the targeted creatures is an illegal target by the time Ashes to Ashes resolves, it still exiles the other one and deals 5 damage to you.

Artwork
Loading artwork…
Ashes to Ashes
Fifth Edition · #141 · EN
Nonfoil—Foil—
Card rules
Exile two target nonartifact creatures. Ashes to Ashes deals 5 damage to you.
"Kings and beggars, they end the same— Surrounded by stench, rot, and blame." —Aline Corralurn, "Legacy"
Uncommon · Illustrated by Doug Keith
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Pauper Legal
Pauper Commander Legal
PreDH Legal
Premodern 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
Penny Not Legal
Pioneer 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
If both of the targeted creatures are illegal targets by the time Ashes to Ashes resolves, it’s countered. It doesn’t deal 5 damage to you.