Low wings are favored for civil aviation because this puts the passenger cabin on top of the wing. Damage from non-normal landings (gear up, no runway, missed the runway, etc.) will happen to the wing, first. Thus protecting passengers. Fuel tanks are usually in the wing and having them also underneath is considered good for the same reason. A low wing allows engines to be near the ground for easy servicing. And main gear legs fit conveniently into low-wing structures. The legs are tidy and short with low wings.
High wings are favored for military cargo and passenger planes because the high wing keeps the engine, propeller, fan, etc, away from the ground. Military cargo and passenger planes don't always have paved runways- a flatish spot may be as good as they get. High wings make landing gear design more difficult, they're either taller, or stick out from the fuselage and are narrow, maybe mounted in pods on the sides of the fuselage, with extra weight and drag. High wings require strong structure to keep them from crushing the passenger space, in a crash, which is extra weight and complexity. High wings make fuel tank access and engine access difficult. But high wings protect the engines, and that allows high wing airplanes to operate in rough conditions. Meaning it can take off again, after each landing.
Dihedral provides stability to low wing airplanes by giving negative feedback to stabilize straight and level flight. Anhedral reduces stability, allowing a high winged airplane to be maneuvered more easily, but doesn't enhance straight and level stability.