This is going to massively depend on the genre, style, person, and publishing model. I think for me the best length is 200~400k words, which make three to five physical books. Shorter and it can easily feel rushed and unsatisfying, longer and they tend to drag out and become too convoluted, like Game of Thrones - good story but at some point it becomes a bit too much to keep track of.
With that said though, there's a lot of exceptions to that. Azarinth Healer has 3 million words and it's good, because it's supposed to be a long, gradually progressing story and there's not much deeper plot until close to the end - plus it really helps it was released gradually over many years, chapter after chapter. That makes it fundamentally different from a shorter story that's supposed to be thrilling and engaging, with quick development and a lot of action.
I've also read a number of stories where each volume was completely separate from each other, sharing only the main cast and uniform timeline. Then it's different, because arguably each book is its separate satisfying story - though I never liked how quickly many of them ended.
And the last kind I'm gonna mention (there's probably more) are stories that are supposed to describe a very short period of time. You won't encounter them much online, but they are much more common in paperback and especially popular in the historical genre. When your action spans a month, or a week, or even a day, you can't make a long story - they are usually 50-100k words long if even that, but they can also be really good.
Sooo... TLDR: around 200~400k is the best for me if we're talking about a model similar to modern fiction. Depending on a number of details, every length can be good, but it has to roughly match the genre, style, and content.