You're better off driving. The last Pacific Surfliner going south on weekends (796) leaves LA Union Station at 10:10. You might barely make it if you take the first Dodger Stadium Express after the game ends. And that's if the game is short.
The traffic may be bad, but bad traffic is probably better than being stuck and needing to take a cab back to Anaheim. That's kind of the way it is in Southern California and especially trying to take any kind of public transportation to Orange County.