I would like to buy a PC instead of a laptop, only the risk of damage from power outages bothers me.
If you have to worry about it, you can get a UPS…
Buy a UPS:
https://www.apc.com/shop/de/de/categories/power/uninterruptible-power-supply-ups-/computer-and-peripheral/N-a4lk5l
Usually nothing happens except that unsaved things get lost. Just have to press CTRL + S regularly, then not much is lost.
So there's a very small chance that something will not start up or something.
There's something called UPS (or UPS in English).
Most affordable home devices last a few minutes, so enough time to safely shutdown your PC.
The risk is extremely low. What kind of sensitive data do you want to store on it that a power failure can trigger a catastrophe?
Usually it is enough to back up your data from time to time.