For the setup you describe, the iMac 27-inch 2013, running macOS High Sierra or earlier could be used as a monitor.
IF your MacBook Pro 13-inch is from 2019 or earlier AND running macOS Catalina or earlier, then connect the two with a Thunderbolt or Thunderbolt 2 cable.
Please read carefully this support document that details the former target display mode –
Use your iMac as a display with target display mode - Apple Support:
https://support.apple.com/en-us/HT204592
In a nutshell:
Target display mode is a feature that was available only with certain older iMac models.
Only the following older iMac models can be used as an external display when plugged into another older Mac model:
- iMac models introduced in 2011, 2012, 2013, and mid 2014 using Thunderbolt or Thunderbolt 2 cable.
- 24-inch and 27-inch iMac models introduced in 2009 and 2010 using Mini DisplayPort cable.
- The intended target iMac must be running macOS 10.13 High Sierra or earlier.
- In all cases the source Mac that you're connecting FROM must have been introduced in 2019 or earlier and have macOS 10.15 Catalina or earlier installed.