The 8-core Xeon W-2145B is used in the iMac Pro and the i9-9900k in the 2019 iMac. They both use 14 nm lithography.
In general it appears the i9-9900k in the 2019 iMac provides roughly similar performance to the 8-core iMac Pro for less money. The iMP still has better GPU performance than the Vega48 in the 2019 iMac. It appears the 2019 i9 iMac is quieter than the 2017 i7 model but not as quiet as the iMP.
The iMP has more ports, two separate Thunderbolt controllers, and 10-gig Ethernet.
I think the Xeon W-2145 is Skylake or 7th generation, the i9-9900k is "Canon Lake Refresh" (CLR) or 9th generation. CLR has some hardware mitigations for the Spectre/Meltdown vulnerabilities, whereas older CPUs have to use firmware or OS patches. This might make a performance difference on some workloads but I don't think anyone has specifically tested that yet.
For video editing or transcoding the i9-9900K has the latest generation of Intel's Quick Sync. If software uses this it can accelerate encode/decode to/from H264 or H265/HEVC significantly. Xeon does not have this. On the iMac Pro FCPX uses AMD's similar (but less effective) technology called UVD/VCE.
The Xeon supports ECC RAM (used by the iMac Pro), and the i9 does not. In theory this can improve reliability. I don't know reliable numbers but I've seen estimates that without ECC RAM, a single-bit error every week is possible.
The i9-9900K has somewhat better single-thread performance.
Apple's power consumption numbers state for similar configurations the 2019 i9 iMac 27 consumes 262W whereas the 2017 i7 iMac 27 consumed 217W. However limited testing to date has shown the i9 iMac apparently runs cooler with less fan noise than the 2017 iMac. The reason for this has yet to be determined.
https://support.apple.com/en-us/HT201918
Apple doesn't list power consumption for the 8-core iMac Pro but for the 18-core it is 370W:
https://support.apple.com/en-us/HT208378 Of course the iMP has a greatly improved cooling system vs the iMac.
https://ark.intel.com/content/www/us/en/ark/compare.html?productIds=126707,186605