Yes, you could use the 2011 iMac as a display for the 2014 or 2018 Mac mini.
Please read carefully and understand > Use your iMac as a display with target display mode - Apple Support
Target display mode is a feature that was available only with certain older iMac models.
Target Display Mode has been deprecated by Apple since 2014, and is no longer supported in any way in current Mac hardware or macOS software.
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.
- The intended target iMac must be running macOS 10.13 High Sierra or earlier; it does not work with macOS 10.14 Mojave or later, or with Boot Camp and Windows.
- 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.
However, as Rudegar posted, a true monitor will use less energy than the iMac as it is also running all the associated internal hardware of the computer. If you also include the cost of DisplayPort or Thunderbolt cable, it's def more expensive to run the iMac as a monitor.
imho, to use TDM today is inviting a bag of headache.