How do you replace an old domain without breaking serialized data?

Back up the database and use a WordPress-aware migration or search-replace tool that understands serialized PHP values. A plain SQL text replacement can change string lengths and corrupt options, widgets, builder data, and plugin settings.
Run a dry run for every old URL variant and review the tables and replacement count. Exclude immutable identifiers when the plugin documents them. Use command-line tools for large databases and keep the operation inside a protected maintenance window.
After replacement, save permalinks, clear caches, and search rendered HTML plus the database for remaining references. Test media, menus, widgets, builders, forms, licenses, webhooks, and login. Keep the original backup until the new site is stable.