Do you mind providing us with a little more info on your RAM? The model number and how much you are using would be nice. 8, 16, 32 GB, etc?
XMP profiles aren't necessarily stable for every kind of RAM at every available setting. The voltages or timings could be incorrect. I'm not super familiar with the Z370 or any recent Intel platforms, but you can check your vendor list to make sure your RAM is compatible with that motherboard. I don't think that's as much an issue with Intel right now, but I may be wrong. The link is here:
https://www.msi.com/Motherboard/support/Z370M-GAMING-PRO-AC#support-mem-3
You can also update your BIOS if that is something you are comfortable with. It may not be an issue, so make sure you follow the instructions carefully if you decide to update the BIOS. This always carries some inherent risk of bricking your mother board. Here's the link for the current BIOS:
https://www.msi.com/Motherboard/support/Z370M-GAMING-PRO-AC
I say all this to come back to the fact that you want it to run at 3000 MHz, and you say that it is currently doing that. I would recommend running a stress test like Prime95 on the blend test for somewhere in the 3 to 6 hour range. If the system does not hang, crash or exceed the recommended temps for your CPU, etc, then you should be golden.
I believe the recommended highest temperature for the i5 8600k is somewhere around 95 C, but i would recommend staying under 80 C. That shouldn't be a problem if you are just doing regular gaming with no overclock on a stock cooler.
Here is a link for Prime 95:
GIMPS has free software available for Windows, Linux, FreeBSD, Mac OSX. Contribute to the effort by using your computer's spare processing power.
www.mersenne.org
And a link for HWiNFO that I like to use to monitor temperatures:
Start to analyze your hardware right now! HWiNFO has available as an Installer and Portable version for Windows (32/64-bit) and Portable version for DOS.
www.hwinfo.com
Getting RAM to be stable can be a tricky thing. Often the best way is to manually overclock. There are an abundance of resources here and on other websites to help you overclock and monitor your system while doing so. If it's not your passion, hopefully we can get you stable at 3000 MHz and you can be on your merry way. I believe that your RAM is probably just fine and has a little trouble with imperfect XMP settings , but you can always check with the Windows memory check or MemTest86 to be sure. Here's a link for MemTest86:
MemTest86 is the original self booting memory testing software for x86 and ARM computers. Supporting both BIOS and UEFI, with options to boot from USB.
www.memtest86.com
Let us know how things go and provide any additional info that you can.