I will reject any query that tells me your book needs editing and I suspect most agents will agree that this is a red flag. But why? Don't all books need editing? Why is this a red flag?
For me this shows that you're not ready to query and that your book isn't complete; that you're not sending me a query because you feel your book is ready for editors and readers to see, but because you've done all you can, hit a wall, and want someone else to help you fix the problems. That's not an agent's job; in fact, it's not an editor's job.
Sure, every book needs editing and an author needs to be willing to edit, but an agent's job or editor's job is to help you reach deeper than you've ever reached before to find ways to take what's already a great book and make it phenomenal. When submitting to an agent you need to look at it, sit back in your chair, and say, "Yes, edits are done. It's ready." Not, "Well, it still needs work, but I'll query anyway."