If you have a spell or ability that produces acid. Examples would be Acid Splash, or a Dragonborn's Breath Weapon in acid form. Could these be used against locks or other barriers such as doors, chained gates, metal bars, etc?
It depends on the actual spell:
A spell's description tells you whether the spell targets creatures, objects, or a point of origin for an area of effect (described below). (PHB 204)
If a spell does not say that it has an effect on or can target objects, then it cannot, per RAW. A DM can of course rule otherwise, but that depends on the particular situation and DM.