I recently needed to wipe and start fresh with an old iPhone 5 to use as a WiFi-only device (essentially like an iPod Touch) but it did not have a SIM card in it anymore and would not let me finish the initial setup without one. This article provides a few suggestions for getting around this limitation: https://www.macworld.co.uk/how-to/iphone/activate-iphone-without-sim-3643294/. It comes down to either borrowing someone else’s SIM card for a few minutes just to activate, using iTunes (only if the phone is not locked to a carrier), or jailbreaking.
Fortunately I had another old SIM card for the same carrier and I was able to pop that in for the initial setup to complete. Then I took the SIM card back out and the phone continued to work just fine using WiFi.