Both are long-running shonen series, but they are doing quite different things.
Dragon Ball Z is a fighting show. Martial artists use increasingly inhuman techniques to defend the world, and the appeal is escalation: stronger opponents, bigger transformations, longer power-ups. Rating: 9/10.
One Piece is an adventure about pirates chasing treasure across a vast, invented world. Its lead character cannot swim and has the power to stretch his limbs, and the show leans far more on comedy, world-building and a large ensemble cast. Rating: 6/10.
Which is better depends on whether you want escalating combat or a sprawling voyage, so the honest answer is that the two are not really interchangeable.