No you are safe when it to equip a new buddy. I also had that problem and after achieving the required 100 candy I was free to immediately evolve my Feebas.
As credited to @yoozer8
Note that the distance walked is tied to the specific Feebas that was your buddy. If you have more than 1 (or if you hatch/catch a better one later), you'll have to walk the one you want to evolve, even if you've already walked another 20km