When a single router learns multiple routes to the same destination the router has to make a decision on what route to use. A router cannot use metrics to determine best routes because they are different among multiple routing protocols. Instead routers use Administrative Distance of the route to learn where to send traffic.
The above table shows the default administrative distance values for the types of routes, the router will always choose the lowest administrative distance route for each unique best subnet. These default values can be overridden using various configurations based on each routing protocol advertising a route.