What you can call best is actually depends on your requirements and design of the test scripts. CodedUI is a tool used for desktop and web-based automation, it is packed with Visual Studio. Visual Studio is a licensed product and if one wants to have a test manager (which is needed for CodedUI tests) the costing become very high. It was integrated with VSTS 2010. As it is a product of Microsoft, only 2 languages are supported but mainly people use C#. Talking about Selenium, so it is mainly used for web-based automation. Selenium can be plugged in with any programming language can work on any platform. And as it is also open-source, it is highly customizable as per our needs. In order to choose the tool /framework for automation a lot of other environmental factors are involved, selenium fits into all of them.
Multi-language support
Multi browser support
Free /open source
Parallel execution
Mobile automation support. (appium)
Matured community
Gets help easily if stuck.
So as I mentioned earlier, there is decision dependency for design and requirements from client one should select the automation tool /framework. If you want to learn Selenium and want to make your career in it then you must take up the following Selenium Training Course. You can also have a look at the below-mentioned video tutorial. .