History of India starts with two Dynasties,both had sprung from Vaiwaswatha Manu.The Suryavansh,the Solar Dynasty was founded by Manu’s son, Ikshvaku , while the Chandravansh Lunar Dynasty was by Ila, daughter of Manu.So , Solar and Lunar dynasties are related by blood.
There is then the Yadava Dynasty, to which Sri Krishna belongs.The Dynasty is named after Yadu. ‘Yadu is one of the five Indian tribes (panchajana, panchakrishtya or panchamanusha) mentioned in the Rig Veda. Krishna is the descendant of Yadu from Vedic tribe’https://en.m.wikipedia.org/wiki/Yadu
An interesting fact is that Sri Rama’s ancestor, Mandhata was married to a Yadu princess.
‘Mandhatri or Mandhata (Sanskrit: मान्धातृ, Māndhātṛ), in Hindu mythology, was an Ikshvaku dynasty king and son of Yuvanashva. He married Bindumati Chaitrarathi, daughter of Yadava king Shashabindu and granddaughter of Chitraratha. Source. Wikipedia Mandhatri.
Thus,Sri Krishna is related to Sri Rama . Krishna’s Ancestor Chaitravathi was married to Mandhata,Sri Rama’s Ancestor.
Thus Sri Rama is related to Krishna as Krishna’s Great Aunt’s descendant ( removed by Thirty Seven generations.