This is a great question, and there's no one clear cut answer. It really comes down to your individual goals and the type of book you're writing.
Traditionally publishing is widely considered the more “official” route, as your book would be “vetted” by a publisher, giving it greater legitimacy in the literary world. It also allows your book to reach a wider audience, as it would be available in bookstores, libraries, and other outlets. Additionally, you will retain certain rights to your work and will receive an advance, royalties, and additional earnings based on the sale of your book. It can also provide you with more exposure and have other writers, editors, agents, and other industry professionals review your work.
However, the downside to this approach is that the traditional publishing process can be slow and tedious, which can affect your timeline. You also won’t always have control over the creative decisions, such as the cover design, the marketing strategy, and other elements. On top of that, you may need to negotiate with a publisher for the rights to your work, and there’s no guarantee that your work will be accepted.
Self publishing on the other hand, can provide you with greater creative control over your project. You can be as involved as you choose - from the editing to the cover design. You also have complete control of where your book is sold and when you release it. Additionally, it’s often faster than traditional publishing and you can reap the rewards (royalties, etc) much more quickly.
The downside of this approach is that you don’t always get the same attention in terms of reviews, awards, and other industry points. Additionally, you need to have a good handle on the entire publishing process, as well as manage your own marketing and distribution efforts.
Ultimately, there is no one-size-fits-all when it comes to these two approaches. The best thing to do is to determine your goals and consider the pros and cons of both choices before deciding which route to take.