The two options enable two completely different systems -- in principle, at least,
Putting your car in "Park"
This locks your central transmission into a fixed state, by mechanically freezing the clutch. (Exact approach on how that works depends on the specific model of car.) That means that your wheels are still free to roll -- even on a steep hill -- and you're relying on that transmission-locking mechanism to resist moving.
If you're on anything but a steep hill, then putting your car in "Park" is just fine. Period. Engaging the hand-brake is completely redundant. (And if your car is less than 20 years old, there's a good chance it wouldn't make any difference at all.)
Using the Parking/Emergency Brake
This is basically just a second brake pedal. Pulling on it engages the brake pads on each wheel, as if you were stomping on the brake. Locking it in place is pretty much the same as if you stomped down like that, and then just sat there like that for a couple of hours. (Again, the exact implementation completely depends on the specific model of car.)
If you're actually on a steep hill, then engaging the hand-brake is -- again, in principle -- a more reliable option, since you're now relying on your brake pads to stop your wheels from spinning at all. Those pads are designed bring your car to a screaming stop from 50+mph to zero in a matter of seconds. Asking them to resist the force of slowly rolling down any slope, no matter how steep, is trivial.
Given all that, there are still some important points to keep in mind...
The underlying concepts of how a car "works" for these are so outdated that they're almost completely irrelevant. All of this guidance stems from a time that "cars" were purely mechanical systems, and questions of how to balance one system against another (like this one) really made a difference in the longevity and performance of a car. Modern cars are such complex, automated entities that this is all very likely moot for any car manufactured in the past 20 years -- I'd be pretty shocked if "putting the car in Park" and "pulling on the handbrake" aren't really just the equivalent of pushing the same button, two different ways, in most modern cars.
None of this is really valuable, compared to the most important single piece of advice for parking on a steep hill...
Curb Your Wheels.
Curb Your Wheels.
CURB YOUR WHEELS.