These numbers refer to the type of plastic. Types 2, 4, and 5 are safe in and of themselves. But they might not be safe if the manufacturer uses non-food safe dyes or release agents to make the items. So you might have two different buckets made from the same type of plastic, and one is food safe and the other is not.
Items that are designed to be safe for food are usually marked "food safe" in some way, either with the icon or the words "Food Safe" or equivalent. You are also probably okay using containers that were previously used to ship food (e.g. frosting buckets from a doughnut shop) or drinking water. Containers that are not marked Food Safe might be safe as well, but they might not be.