You can but the considerably lower gain of the 12AU7 often makes this tube useless in guitar amps. The one exception is in high gain amps which have way too much gain and overdrive.
In a given circuit, a 12AU7 will usually draw significantly more idle current than a 12AX7. This might cause problems in certain modern PCB-based amps that have 1/4-watt plate resistors, instead of the usual 1/2-watt or 1-watt plate resistors found in vintage and boutique amps. There's the risk that the extra current draw may cause the power dissipated by the resistor to exceed its 1/4-watt rating and burn out.