For the safety lever shaft to cam into and engage the hammer's rear safety notch, the sear has to hold the cocked hammer back far enough to allow the safety cam to rotate into the hammer notch. If, for whatever reason, the hammer isn't cocked back far enough, the lower edge of the safety shaft "cam" hits the lower edge of the hammer safety notch comes to a stop before entering . . . pulling the hammer manually back a little, allows the safety to engage . . . not right, of course.
The problem can be, as ThnkFrst and others suggest, one of a few things:
The safety lever shaft is out of spec. It's a MIM part, and I've seen variations in the dimension of the shaft cam section - a few licks with a file, or a new safety lever, fixes this if it is the cause, but check other stuff too, as other things can cause it.
The sear pivot pin has shifted to the side allowing one end of the pin to come out of the frame hole. Sear then goes out of alignment with hammer full cock notch and hammer full cock it a little too far forward. Was there a batch of too-short pins?
Sear is dimensionally out of spec - it's also a MIM part and I've found poorly aligned sear to hammer engagement surfaces on several guns. A trigger job, with the sear stoned can do this. Or simply a wear to the sear/hammer interface that decreases the distance from the sear pivot hole to its engagement surface (fit tolerance may have been tight to begin with and wear pushes it into the "don't work" range.
With a properly fitting P938, as you engage the safety with the hammer cocked, the sear should cam the hammer back a little (further cocked if you will) as the safety is engaged - watch the hammer from the side to see this.