Some good comments on here, some (presumably ChatGP) nonsense too.
Have a look at this ZF parking pawl.
View attachment 7916406
When you engage park the pawl may drop into one of the slots, or on a flat section.
If you engage park on a hill and the pawl is resting on a flat section the vehicle will roll until the pawl engages. That will eventually wear the pawl or the gear.
Note the pawl on the ZF HP8 is controlled by a solenoid using hydraulics, actually the solenoid disengages the pawl rather than engages it.
Just to be clear...
The primary method of stopping a parked vehicle from moving is the handbrake. For example normally an electronic parking brake is automatically engaged when the vehicle is stopped.
While unlikely to break, replacing a parking pawl and ring will never be cheap.
If a handbrake doesn't work, it needs adjusting or the pads/shoes replacing.