You should use whatever is more effective, comfortable, economical, etc.
Some traditional methods of guitar will insist on using certain fingers for certain strings or related ideas like hitting repeated notes on one string by rotating through index-middle-ring, etc. There is often a good reason for this, but none of these work in all situations — much less are always the best idea. Take them as guidelines.
However, you do want to make use of your pinky on songs where it's not "needed", at least when practising, because it is generally the weakest finger and you want to build it up before you do need to rely on it.