Here's my experience, take it for what it's worth. Every book will be different. First of all, don't wing it. Study up. I did some research and found this book. It was very helpful:
Getting it Published. Key things to ask: Is this scholarly (a billion footnotes), or not. That will change your target publishers/agents. What is the topic, what is the interest? Many publishing houses and agents have specialties. Look into them and see what they've had published.
The first thing I did was google Texas agents, because my book is Texas history and it's much more likely they would be interested. I started going through them one at a time, contacting them to judge their interest. A couple weren't interested in my topic and one of them was also an author who wrote an Alamo book and just didn't think the market would sell (he didn't seem to understand my topic, but that's beside the point).
Anyway, the takeaways I got of spending my time working with agents were this:
1. If your book is not cookie-cutter, most agents don't care.
2. If you're a first-time author, most agents don't care.
3. If you have a connection to them, use it. Didn't help me win a contract, but got a better reception.
What I ended up doing (may not be right in your case) was picking publishers and targeting them directly. Now here's the trick: It's apparently bad form to pursue more than one at the same time, so you have to do it serially. I picked target No. 1 and sent them my proposal (they will have guidelines on their website - the book talks a lot about that). That proved a failure as they were out-of-state and had little interest. Target No. 2, after careful consultation with my brain trust, ended up picking up the book.
Here's the trick: I started this process in early 2020. I finally got a bite from a publisher in mid 2021. I started going through the peer review/edit process in late 2021. In late 2021, they approved my book, then in early 2022, they said, congrats, it's on the publishing schedule for Fall of 2023.
To give you an idea of how it works:
1. Email publisher No. 1. Their website says they will reply in six weeks.
2. Six weeks later, Publisher 1 has a follow up email. I respond right away. 2 weeks later, they say no.
3. Email publisher No. 2 Same thing
4. Six weeks later, they say they're interested. Send us a chapter.
5. I send chapter.
6. A month later, they say they love it and send us more.
7. I send whole book
8. Two months later, they say they love it and it will go to the panel.
9. Four months later, the panel loves it.
10. 1 month later, they say they'll send to peer review
11. Peer review gets it.
12. 2 months later, peer review responses are in.
13. Takes me 2 weeks to prepare my response and send it in.
14. 2 more weeks (maybe more), they accept my responses.
15. I start editing based on my plan.
16. Four months later I'm done.
17. A month later, they finally give me my date.
Or something like that.
Not saying it will always work out like this, but it's a long process, and it's not a problem to start pitching before the book is done, as long as you have some sample chapters and a good plan. I basically spent from 2017-2020 writing my book, 2020-2021 pitching (while continuing to edit and improve it) and now I'm waiting. It'll be six years all told. Now, not all books are the same. If your story is more straightforward and not on an obscure topic like mine, maybe it'll be shorter.