Check a gadget’s battery compartment before buying replacements
Read the cell code and inspect the holder to avoid an unreliable fit.

Before you start
Use the model manual and the marking in the battery tray to confirm the exact cell code. Take a picture of the marked orientation before removing the old cell. Cells with a similar diameter may be a different thickness.
How to test it
With the gadget off, inspect whether the tray closes flat and its fastening hardware is intact. If you see corrosion or a damaged contact, consult the maker. Check that the compartment closes securely after installing the specified cell.
My recommendation
I would buy the exact battery code and replace a damaged compartment instead of improvising a spacer. Store loose button cells securely away from children and pets and follow the battery maker’s disposal guidance.