It’s not explained well. Essentially with the combined fact that there were two souls inside Harry for the spell to target (Harry and the Horcrux) the Elder Wand Voldermort was using being loyal to Harry, and the protection spell from Harry’s mom being applied to both Harry and Harry’s blood inside Voldemort.
Voldemort didn’t die when all the horcruxes were destroyed bc THEY were destroyed, not him. Harry WAS killed and I guess you can argue “it was the horcrux killed, not Harry” but Dumbledore specifically said he was raising Harry to be a sacrifice for Harry to die to kill Voldemort. And said the reason Harry could come back to life was ONLY bc his blood was in Voldemort. So when Voldemort died all of Harry’s blood was dead