Your bike does not have 25 gears.
You don't have 24 or 27 gears either.
You can have 24 or 27 different combinations.
Some of those shouldn't be used due to cross-chaining.
Some are repeat ratios.
As a crude rule-of-thumb, expect to have about 2/3 as many usefully different ratios as you have possible combinations.
Opinions on mixing 8-/9-speed vary.
8- and 9-speed cassettes are equally wide.
So the sprockets are spaced tighter by some fraction of a mm on the 9-speed.
Now, (at least) Shimano derailer pulleys have some sideways float.
Which forgives a bit of mismatch.
Even mixing 7/8-speed will usually kinda-sorta work.
And they have a bigger difference in spacing.
Whether or not you'll be content with the performance is impossible to say.
Degree of wear, tune, shifting style and rider expectations tend to play a big role in how satisfied someone is with a mixed drivetrain.