I know AP as an oxidizer for solid rocket fuels. Maybe it has no other important uses. Rocket companies produce it themselves.
Military uses of AP are limited because (1) it ignites too easily, at heat (2) it produces a trail. Missiles use completely different compounds that resemble single-molecule explosives but burn slowly and produce no solids nor HCl. Launchers use AP because they demand performance.
AP is relatively safe among oxidizers, that's why rockets use it. The plant explosion involved big amounts near a city, bad design. Pure AP, without a fuel, is relatively stable. But the mix with a fuel is ignited by mere heat, needing no shock, and this is undesirable.
AP itself produces only gases and provides much oxygen. Better: nitrogen provides heat by recombination to N2 and the hydrogen a useful combustion gas. "Only" chlorine is undesired. A rocket launch releases hundreds of tons of HCl, equivalent to a major industrial accident.
The "pressure exponent" of AP (mixed with a fuel) is well below 1. This is a condition for use in a rocket. That is, the mass throughput in a nozzle is proportional to the chamber pressure. If the flame front propagation speed at the solid mix varies like P>1 like for chlorates and many nitrates, no stable speed is possible: boom or extinction. With most perchlorates including AP, the flame front propagation speed at the solid mix varies like P<1, so an equilibrium between the produced gases and their evacuation through the nozzle is possible.
Replacements are actively searched but difficult. Ammonium dinitramide (ADN) is a candidate, at least as a water solution. One difficulty is that a limited volume of solid oxidizer can be mixed in the fuel paste (polybutylene) so the result isn't too brittle (cracks are deadly because they increase the flame area), and one even wants to add some aluminium powder for performance. All practical mixes are strongly unbalanced, containing far too much fuel. So a replacement to AP should provide much net oxygen per oxidizer volume.