For the Rifle, the trigger hand is just rotated towards the front grip hand with something like Find Look At Rotation, once grabbed. It probably rotates the root bone of the hand mesh.
As for the Pistol, the slide is moved based on the hand position with a constrained limit. I don’t think there are physics involved at all, maybe for the shotgun-grip.