From the 1977 AAR interchange rules for freight cars, which should be close to locomotive standards:
Flanges must be greater than 15/16 inch thick, and less than 1 1/2 inches above the centerline of the tread. The flange doesn't grow, but the tread wears, and if the center is worn enough, the flange is too deep relative to the railhead.
Rims: Greater than 7/8 inch on 28, 36, and 38 inch wheels, greater than 3/4 inch on "all other" wheels. That would obviously be the standard 33 inch, but I don't know if it includes 40 inch, as they weren't usually used on freight or passenger cars in interchange service.
Then there are all kinds of other defects and damage that can get the wheel condemned.