Kepler's laws state that a planet's orbit is an ellipse, it sweeps out an equal area per unit of time. The third law #p^2=a^3# relates period to semi major axis distance. In fact the third law as stated only works if the period is in years and the semi-major axis is in Astronomical Units (AU). These laws apply to all planets irrespective of mass.
To understand why this is the case, we need to use Newton's laws. The force a sun exerts on a planet is #F=(GMm)/a^2#, where G is the gravitational constant, M is the mass of the sun, m is the mass of the planet and a is the distance between the sun and the planet.
There is a second equation #F=maω^2# which describes the angular velocity ω a planet will have as a result of the force. Combing the equations gives #(GMm)/a^2=maω^2#. See that the mass of the planet cancels out to give #(GM)/a^2=aω^2#.
This explains why the planet's mass doesn't affect the orbit.
Now the period #p=(2π)/ω# or #ω=(2π)/p#. Substituting this into the earlier equation gives #(GM)/a^2=(4aπ^2)/p^2#. Multiply both sides by #p^2a^2# gives #GMp^3=4π^2a^3#.
Using the Sun and Earth as a base and selecting the unit of distance to be 1AU and the unit of time to be 1 year, the constant term #(GM)/(4π^2)=1#. This gives Kepler's 3rd law #p^2=a^3#.