They're often both used rather than a vs situation. Ultrasound around day 24 after mating gives a frequently accurate count of the number of pups and location, and then xrays done within only a few days of delivery will give a better picture of size and location for the actual birth. If a pup dies in utero, it may be absorbed, allowing the remaining to grow larger than they would have been, but would only be known if a second count by xray is done later.
Particularly for toys, this can be the non emergency determiner for scheduling a c-section.
Information on pregnant dams, Pregnant Dams spend a lot of their time in the last week stretched out, to get those puppies into position.
www.dogbreedinfo.com
If you're going to do only one, I'd think the xray very shortly before the due date is the choice. The pups size and position are pretty clear then and potential problems, like pups too large or blocking the canal or breech, are more easily seen and lives may be saved.