Homebrew beer that tastes sour is almost always caused by a bacterial infection which produces either lactic or acetic acid as a by-product.
Preventing these infections requires proper sanitation before, during, and after the brewing, fermenting, and bottling stages.
Without a doubt, the single biggest source of a sour note in your homebrew is a bacterial infection that happened at some point in your brewing process after the boil. It has happened to thousands or millions of homebrewers over the years at one point or another and it just plain sucks.
As its name suggests, lactobacillus bacteria produce lactic acid which is the compound that actually produces a sour flavor on your tongue. They are extremely common in the wild and it’s even used on purpose in many cases to make certain types of traditional beer, yogurt, and other fermented foods.
Acetaldehyde is present to some degree in all beers because it’s a common by-product of the fermentation process. It’s even an intentional part of the flavor profile for something like a Biere de Garde or American lagers like Budweiser.
Just like when preventing human bacterial infections, the best way to prevent homebrew from getting infected is to sanitize!
Plastic equipment such as fermenting vessels, tubing, siphons, valves, o-rings, and nuts are great because they are often less expensive than stainless steel pieces.
Some off-flavors can be reduced or eliminated with extended time in the fermenter or extra bottle conditioning.
The short answer is yes. Assuming that the beer has an off-flavor caused by the standard bacterial infection or wild yeast contamination there probably isn’t anything too dangerous in your beer that you will have to worry about.