If it takes a long time to set up or your iPhone stuck on setting up Apple ID, it could due to the following reasons:
1. Your network connection is unstable.
2. The Apple Server is overloaded.
3. There are iOS system issues with your iPhone.