The fifth finger is needed to twist the object in the hand. Three fingers are needed to hold the object, the fourth and fifth - for manipulation .......
Firstly, the ring finger is not so useless, and secondly, we inherited a lot of interesting and not always useful things from our ancestors. This is due to the basic principles of evolution in living nature: if a trait does not affect the reproductive success of individuals and the survival of the offspring, then it may well persist for itself indefinitely. As an example - hiccups. Our ancestors have inherited it as much from lung-breathing fish.
We use our fingers not only to manipulate them. We also hold, grab, twist and twirl them. While the Index, Medium and Large perform the main functions, the Nameless and Little Finger are auxiliary. These are additional support, additional leverage, additional weight distribution, and the like. Try, for example, picking up a heavy book on the table with the tips of your thumb, forefinger, and middle finger and try turning it over. You seem to be doing it? Now do the same with the ring finger. Set aside a little, it acts as a lever, and it will be easier to turn the book over. With the Little Finger, you don't pay attention to this procedure at all, because then it will be completely trivial.
In general, despite the fact that the muscles of the Ring finger are the least developed among all fingers, it was the presence of all five that allowed a person to create what he creates. Otherwise, if they were not needed, they would disappear naturally.