(This is based off of fanon Preboot UKB lore.) Sans uses the hacking abilities he's gained to increase his stats, but while doing that he takes physical damage, causing him to get the crack in his skull seen in Phase 1. In Phase 2, Sans activates a failsafe that would max out his stats at the cost of destroying his hacking abilities. In Phase 3, he injects himself with artificial DT, causing him to become an op ticking time bomb with five minutes remaining until he blows up. Since the human saved before the Sans fight, they're now trapped in a cycle of being turned to ash when Sans explodes in Phase 3.
Preboot UKB created by Memeforce and owned by flake Sum of Your Actions created/owned by me Sprites by me