If you're recording the full desktop, then use ShadowPlay if you have an nvidia card (it comes with the nvidia software and utilizes the native GPU encoding). Otherwise, use the Xbox Game Bar, which is installed by default in Windows 10.
If you need to record a specific portion of the screen, I'd recommend the open source tool Captura: https://mathewsachin.github.io/Captura/
It's no longer maintained as of July 2020, but it's quite effective at what it does and is not lacking for features. I use it for recording UI interactions all the time.