Both Pentax 645Z and Fujifilm GFX 50S have 51.0 MP resolution sensors but Pentax 645Z's sensor is Medium format (44 x 33 mm ) and Fujifilm GFX 50S's sensor is Medium format (44 x 33 mm ).
Since Fujifilm GFX 50S's has a larger sensor area with the same resolution, this means that it also has a larger pixel area hence better light collecting capacity for a given aperture compared to Pentax 645Z.
Another difference between these two cameras is that Pentax 645Z's sensor lacks anti-alias (Low-Pass) filter. Removing anti-alias filter increases the sharpness and level of detail but at the same time, it increases the chance of moire occurring in certain scenes.
Below you can see the 645Z and GFX 50S sensor size comparison.
Pentax 645Z and Fujifilm GFX 50S have sensor sizes so they will provide same level of control over the depth of field when used with same focal length and aperture.