Yellow No. 5 and all other numbered dyes (colours) are made from petrochemicals. In their pure form, they are Halal. However, when used in food products, they may be mixed with other doubtful or haram ingredients, such as gelatin. Sometimes non-dye ingredients may be added to dissolve or disperse the dye so that it can be applied in a drink, hard candy, or other food product. Finally, standardising ingredients may also be added to help control the concentration of the dye being used. This causes some doubt about products containing these dyes.
To determine if the product containing the dye is Halal, you should ask the manufacturer of the product what the other components of the dye are and from where they come. Of course, if the product containing the dye is certified Halal, then it would be acceptable.
And ALLAH, Subhanahu wa ta’ala, knows best.