Does your player have a rigidbody or character controller? If so, the “random movement” you’re seeing might be the result of the effect of gravity fighting your moving upwards. Your code just moves the character up at a constant speed, but his downward momentum will be continuously increasing while you’re not touching the ground, so these two will be fighting each other before long. And because physics updates and Update() don’t happen at the same time, this is probably going to look weird and flickery.
If you are going to use gravity, I’d suggest adding a force to create jumping.
Otherwise, how about using translation for your jumping and disabling gravity for the rigidbody while in the air, re-enabling it upon being grounded again.