Both ways are right, though in both cases you don't use the most general unifiers (MGU). If you cancel the first literals of each disjunct, the MGU is z/h(x) and the resulting disjunct is

{P2(g(y)), P2(h(x)), P1(h(y)), P3(g(y))}

If you match ¬P1(h(x)) with P1(h(y)), the MGU is x/y and the result is

{P2(g(y)), P1(z), P2(z), P3(g(y))}

Edit: changed the MGU from x/h(x) to z/h(x).