The Atmosphere vs The Ice
Venus
The baseline for Venus is that is spins retrograde, so reverse to its movement around the Sun, which is uncommon. A rotation takes 243.03 days, an orbit takes about 250 days and the obliquity, axial tilt, is 177.4°.
How it came to be
The formation of planets is a violent process, during which random physicals spins get introduced into the protoplanet. The rotation in the end comes from a bias in the protoplanetary disk, the entire accretion disk of the solar system is itself swirling in one specific direction around the sun. This bias is a prograde, forward spin.
Also, there could be big impacts in the late stages of formation could lead to a domination of the final angular momentum budget.
All of this does not explain the current state of Venus, it had in the beginning a normal prograde spin.
The Journey of Venus
To get to this slow rotation regime with a retrograde spin, Venus had to go through an extended period of instability.
As Venus evolved, its precession frequency started to align with the frequencies of its changing orbital plane, which were introduced by the rest of the solar system. This is the concept of overlapping resonances. This lead Venus to eventually flip over and then be able to settle near its 180° obliquity.
The Battle between Tides
To keep Venus at its obliquity, there are two forces that work against each other, gravitational tides and atmospheric thermal tides.
The gravitational tides slow down the rotation of the planet, it tries to lock the tidal bulge to points towards the sun, in a mostly circular orbit it wants to get to a 1:1 spin-orbit resonance.
The atmospheric thermal tides try to accelerate the spin. On Venus this effect is also bigger, compared to earth, since the atmosphere on Venus is incredibly dense, mostly carbon dioxide with pressures up to 90 time compared to sea level on earth. This atmosphere gets heated a lot at the sub-solar point. Which generates a continuous motion of gas away from this point. This generates an atmospheric bulge, perpendicular to the sun-planet line. This generates the speed-up of the rotation.
Also, friction at the Core-Mantle-Boundary (CMB) slowed down the rotation, but near 180° obliquity, core-mantle friction does not affect the rotation anymore, and the two tidal forces can balance each other out.
Mars
The sidereal period is about 24.5 hours, its obliquity sits at 25.19°. This difference to Venus is mostly due to the distance. Gravitational tidal breaking is heavily dependent on distance and virtually negligible for Mars.
So Mars has mostly maintained its primordial rotation speed.
The Wobble
Mars is wobbling on its axis and its axial precession is dangerously close to the secular frequencies of the solar system. These are the long-term shifts in a planet's orbit plane caused by the gravitational pulling of all other planets, particularly massive ones like Jupiter. This forced Mars obliquity to perform large variations over millions of years.
The Crazy Seasons
During Martian winter, the poles get so cold, down to -150°C, that the carbon dioxide freezes out of the atmosphere. About 25% of the total atmosphere deposits itself this way on the poles. The atmospheric pressure drops, and extreme winds flow towards the poles.
This changes the polar moment of inertia, and since angular momentum needs to be conserved, the rotation rate also changes. This leads to shorter Martian days.
Because Mars has an eccentric orbit, the southern winter lasts longer than its northern winter. So the South Pole has more time to pull mass out of the atmosphere. This leads to asymmetrical annual fluctuations in the planets LOD. These fluctuations are around tens of milliseconds.
This also leads to polar motion, the poles move around in a small circle, the most prominent component of this free polar motion is the Chandler Wobble. This wobble is fundamentally determined by the dynamic flattening of the planet, the J2 value. If it Mars were a sphere, the circular wobble would be 190.8 days. But with the deformation of Mars this gets slowed down to around 200 days.