If you've got good roller luggage, and assuming your ship docks at one of the northern berths, you could walk from the ship to the wonderful Santa Fe Depot. If it's a trek or you just don't want to walk, an Uber will get you there in 3 minutes.
Then you take one of the dozen-per-day Pacific Surfliners from San Diego to Anaheim. They leave every 90 minutes or so. It's wise to make a reservation, and spring for the extra 13 bucks for "Business Class". You don't get a whole lot of extra service in Business Class, aside from a free drink and a USA Today, but the car is quieter and there's more leg room and you have a better chance of having space in the luggage racks for your bags. Business Class is worth it for the luggage convenience, and reservations put your mind at ease.
https://www.amtrak.com/home.html
Sit on the left side of the train for great ocean views from Del Mar to San Juan Capistrano.
Two hours later you are at Anaheim's ARTIC station, go out front and get an Uber to your hotel.
The whole thing will take about three hours, maybe four depending on train chosen, from ship's pier to your Anaheim hotel.