TDP is only useful for determining how large a heatsink and how much airflow is required. It has NOTHING to do with overall system efficiency. In your specific instance, the i7-7700T and i7-7700K appear to be sibling processors, with the only difference being the T version has a hard limit imposed on maximum frequency. They will use exactly the same amount of power under light loads, but as soon as you start a heavy computation task, the T will stay throttled back and the K will go to max power. That means your task will take much more time to complete on the T version, keeping all your other items like RAM and drives at full power waiting for the T to be done, while the K is finished and can allow the whole system to go back to idle much quicker.
As a general rule, each new redesign of a chip family brings more efficiency. So to get the best performance per watt as a broad rule you want the newest chipset and die type, and the most powerful CPU in that die type excluding gamer type tweaks. Overclocking tends to reduce performance per watt, so stay within the normal desktop range.