Assalamu Alaikum
From what I've gathered there's really 2 opinions on the matter. The first is that there are foods that have naturally occurring alcohol in them, such as fruits and yeasted breads, but no matter how much you eat from these foods they cannot intoxicate you and are therefore halal. In a similar way, foods that are manufactured with small amounts of alcohol in them such as cakes, sauces, ice cream, etc. are permissible to eat because they cannot intoxicate you if you eat a lot of them (eg. kind of like how kids are allowed to eat vanilla flavored cakes because they cannot get drunk from overeating them). However to intentionally put a haram substance in the food is forbidden. So if you were making a cake and put vanilla extract, it would be haram to eat because you purchased the alcohol which is haram on its own even if you don't use it, and then putting the haram substance in your food, and ingesting it. When they label food, if it doesn't include a large amount of alcohol then they usually do not include it in the ingredient list or they allow it to be purchased by all without age restriction.
The second opinion is that any food that clearly contains a haram substance such as alcohol is forbidden no matter what, and to avoid those food which are doubtful because in the Quran it clearly states that the sin is not in the fact that alcohol intoxicates but that Allah has forbidden us to drink it even if we saw benefit in drinking it.