Depends on the marks of course
Generally speaking though the neither is greatly better than the other. The Panzer IV would rate slightly higher protection wise for example, and depending on the version slightly better arnament wise. To be honest though, in a one on one battle the chances for each were close to even.
Don't fall into the trap of assuming that all late war German tanks were greatly superior to their allied counterparts, the Panzer IV overall was not really that much different than a Sherman. What it did have in later marks was additional spaced armour which helped against some types of enemy fire.
On the other hand though, it depends on the Sherman variant. A firefly sherman would waste a Panzer IV due to it's immensely better arnament. A M4A2 76mm armed sherman would also significantly improve the odds in it's favour.