Comparing O−O bond length in hydrogen peroxide and dioxide(2−) ion
The way to tackle this is to look at the lone pair repulsions between the 2 molecules. It is known that $\ce{N-N};$ $\ce{O-O};$ $\ce{F-F}$ single bonds are quite unstable due to lone pair (lp) repulsions.
An evidence of this is that $\ce{N}$ exists in molecular state as $\ce{N2}$ using multiple bonds, so that it's lone pairs do not repel each other, however $\ce{P}$ doesn't do that. It is capable of forming $\ce{P4}$ because in the third period the size of the atoms are large enough to properly distance the lone pairs.
One more evidence of this act is that among diatomic halogen molecules the bond length is in the order $\ce{Cl2} &lt; \ce{Br2} &lt; \ce{F2} &lt; \ce{I2}$ the bond length of $\ce{F2}$ should have been lower (2p–2p overlapping is much stronger hence the bond should have been the shortest). However, due to lp–lp repulsions it is now much longer bond.
With this we can now see that in $\ce{H2O2}$ there is only two lone pairs on each oxygen atom while in $\ce{O2^2-}$ it has three lone pairs on each atom, hence it has increased lp–lp interaction.
As a result of this $\ce{O2^2-}$ tends to elongate (relatively more than $\ce{H2O2})$ its bond to decrease this intense lp–lp interaction, hence the longer bond.