Yes, you can make a copy of your Dynamics 365 environment before cleanup. I would recommend this over exporting everything to Excel.
In the Power Platform Admin Center, select your production environment and use Copy > Everything to copy the data and customizations into a sandbox environment. Before making production changes, also create a manual backup. Test your cleanup in the sandbox first, especially if you are merging duplicate accounts or contacts with related records, activities, or opportunities.
Dataverse has built-in duplicate detection and merge capabilities, so Excel is not always necessary. Exporting and reimporting can introduce issues with relationships and record IDs.
Microsoft Documentation: Copy an Environment