> This is an order by a California district judge.
No, its an order by a federal district judge in California; specifically, a judge of the US District Court for the Northern District of California. (Media reports often use sloppy language which confuses federal courts located in a state with courts of a state.)
> So that means it must only be valid in California?
No.
> Or if not, then how can a California decision apply outside of the state?
It's a federal decision. In any case, even if that wasn’t the case, much Apple conduct occurs in California even if it impacts users outside of California.