Neither one of those phrases is correct. We are not unique - there are other planets that have an iron core. Venus for example has an iron core. Mars and Mercury too. But not all planets have an iron core. Jupiter doesn’t. That’s just gas. Some of the moons, ok, they’re not planets but you can imagine they could be in orbit as a planet as well, they don’t have an iron core.
Earth is a bit more complicated because we have a solid core and a liquid core. If you only have a solid core you don’t have a magnetic field. That’s the problem with Mars. Ok, there might be some liquid on Mars - we don’t know for sure.
"Earth is the only rocky planet - the only terrestrial planet - that has this strong magnetic field"
But how it works on Earth is that you have an outer liquid core and there are things moving and that creates the magnetic field that is very important. How often you have that is not clear. From our solar system, Earth is the only rocky planet - the only terrestrial planet - that has this strong magnetic field.
I don’t think this is unique though. There will be other planets that have this too. But again, how common this is, we don’t know. But some argue that this is critical to sustain life. At least to sustain complex life on the surface a magnetic field is a great benefit. It might even be critical.