I went on the train between Hamburg and Copenhagen around 2007. Crossed on a ferry between Puttgarden (Germany) and Rødby (Denmark). Looks like this was discontinued in 2019 but I'm not sure what replaces the Hamburg-Copenhagen link. I'm glad I did it, it was definitely a strange experience to disembark the train on to a ferry and go and stand on the deck as it crossed.
The Helsingborg-Helsingør train ferry was replaced (car ferries remain) by railway on the Öresund Bridge (from the 2011 TV series The Bridge) between the big cities Malmö, Sweden and Copenhagen, Denmark in 2000. https://en.wikipedia.org/wiki/%C3%98resund_Bridge