is correct that you cannot use your Late 2013 iMac as a display for your PS5 using Target Display Mode, but I will expand on what iMacs are capable of using Target Display Mode, and with what devices for anyone else that is looking for help with this.
For 27" iMacs:
The Late 2009 and Mid 2010 iMacs can use Target Display Mode with any device that is capable of outputting via Display Port or Mini Display Port. This includes non Apple devices. Not sure if this method could be use with an active HDMI to DP adapter or not.
The Mid 2011 to Late 2013 iMacs can use Target Display Mode with only Macs with Thunderbolt 1, 2, or 3, excluding the M1 and up Macs.
For 21" iMacs:
The Mid 2011 to Mid 2014 iMacs can use Target Display Mode with only Macs with Thunderbolt 1, 2, or 3, excluding the M1 and up Macs.
With the introduction of the 4K and 5K iMacs, there was a technical limitation in the TB2 HW preventing Target Display Mode from working, so Apple abandoned it. When TB3 wa introduced, the technical limitation was no longer a factor, and Apple could have reintroduced TDM with the start of the TB3 iMacs, but chose not to for some reason.
There are SW alternatives, such as using the built-in screen sharing, if going from Mac to Mac, or using the third part SW, Luna Display, but this probably wouldn't help the OP's scenario.