The 2023 MacBook Pros have Thunderbolt 4 ports in the shape of USB-C ports which support Thunderbolt and Display Port protocols with the appropriate adapter.
However, the 2023 MacBook Pros don't support Target display mode as explained in the support document you posted from.
Use your iMac as a display with target display mode - Apple Support
The other Mac that you're connecting it to must have been introduced in
2019 or earlier and have macOS Catalina or earlier installed.
The 2011 iMac also has a very limited resolution compared to the 2023 MAcBook Pro, so the image would never look right even if it was possible.
Get an actual monitor that supports the newer resolutions for best results.