I would say the cores of the Sun and Earth are not very similar. The core of the Sun is made up of hydrogen and helium in the plasma state. The Sun's energy comes from the fusion of two atoms of hydrogen (atomic mass 1) into one atom of helium (atomic mass 2). This means that the Sun's core is mostly compressed gases.
On the other hand, the core of the Earth is comprised of two layers. The inner core is generally believed to be solid, most likely made up of heavy elements such as iron (atomic mass 55.8) and nickel (atomic mass 58.6). The outer core, surrounding the inner core, is liquid, likely made of of the same or similar elements to the inner core.
In this way, the Sun and Earth's cores are not very similar.