Mashing does not help Duck Hunt's upB. Remember that just before his upB ends, you can directional airdodge up to get a last little bit of height.
Side note: Since upB does not have a hitbox, if you want to protect yourself, throw out a can right before you start it. Then you can tap B to have the can cover you as you fly.
This does take practice though, as if you are, say, holding left, to move closer to the stage, and you tap B to try to make the can rise, DH will cancel his upB into a sideB, killing you instantly. You have to be sure to tap the can only when not pressing a direction, which takes practice to work into a good recovery.