That used to be possible using Target Display Mode but that mode isn't supported on your iMac.

See Here

It's hard to come up with a good solution without knowing exactly what you're trying to...