Both Fujifilm GFX 50S and Pentax 645Z have 51.0 MP resolution sensors but Fujifilm GFX 50S's sensor is Medium format (44 x 33 mm ) and Pentax 645Z's sensor is Medium format (44 x 33 mm ).
Since Pentax 645Z'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 Fujifilm GFX 50S.
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 GFX 50S and 645Z sensor size comparison.
Fujifilm GFX 50S and Pentax 645Z sensors have exactly the same size so none of them has any advantage over other in this area.