Both Pentax 645Z and Fujifilm GFX 50R have 51.0 MP resolution sensors but Pentax 645Z's sensor is Medium format (44 x 33 mm ) and Fujifilm GFX 50R's sensor is Medium format (44 x 33 mm ).
Since Fujifilm GFX 50R'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 50R sensor size comparison.
Pentax 645Z and Fujifilm GFX 50R have sensor sizes so they will provide same level of control over the depth of field when used with same focal length and aperture.