Here’s my take on this, as it’s a tough situation to be in.
I can see a couple of avenues to explore, each with its own pros and cons. First, before looking at software, it’s worth checking if your contacts were synced with another service you use, like a Gmail or Outlook account. Sometimes this is enabled by default, and your contacts might be safely stored there. This is a simple, free check, though it’s not always the case.
The other path is third-party data recovery software. These tools scan your iPhone’s storage for deleted data that hasn’t been overwritten yet. The upside is they can sometimes recover the contacts directly. The downside is that success isn’t guaranteed, and the most reliable tools often come with a price tag. It really comes down to weighing the potential cost against how critical those contacts are.