I 'd say, stick somewhere in the middle
Both underplanning and overplanning can restrict a writing process.
overplanning can take the joy and spontanious nature out of writing because your path is so solid it doesn't leave room for any exploration.
and underplanning can have devastating effects later on with the most classic example being an overpowered villain that basicly can't be stopped because due to underplanning we was written way to powerful. resulting in the ever treacherious "dues ex machina" or "magic mcguffin" to solve the problem.
What I noticed is that it's better to have a few loose elements with some set rules and keep the details blurry to give yourself some wiggleroom. Once you write your characters and set their "rules"; by that I mean their "personality traits and motivations, pro's con's etc" The most important thing is that want your characters to be believable. You want to let those traits determine the path of whatever journey they face, and not trough some forceful outside push on the writers end.
This also count for the rules of your world and other aspects. like a magic system, government etc.
make some foundations for these and fill out the blurry lines when you reach them in your story.