Here's the general group people seem to be fairly sure led to hippos; the ones that led to whales might have been an earlier group that gave rise to this group, or perhaps one of these, or perhaps not all whales share a 'root whale':
https://animals.fandom.com/wiki/Anthracotheriidae
The actual kind of data they use to make these judgements is mostly bone fragments from fossils, as comparing modern DNA of hippos and whales can only tell you so much. Here's an example study from 2003 on the hippo lineage:
https://wp.ufpel.edu.br/cdrehmer/files/2017/06/hipopotamo-ST...
http://www.onezoom.org/life/@Hippopotamidae=510764?img=best_...
https://en.m.wikipedia.org/wiki/Pakicetus
> the closest living non-cetacean relative being the hippopotamus.