Spaceship minigame has 2 phases, normal phase and boss phase. General strat in both phases is to hold down space and just avoid getting hit, but it's okay to get hit some. If you let go of space bar at all during the minigame, even once, you are fucking up.
In the normal phase, if you see pizzas, you can grab them to make your weapon do more stuff. You don't have to, but it definitely helps if your weapon is upgraded since it means you kill stuff faster which means they have less time to create projectiles for you to dodge. Once you get 4 or 5 pizzas, getting more won't do anything new so you can ignore them if you don't care about points. Just make it to the end.
In the boss phase, the boss alternates between offense mode and stunned mode. Starts in stunned mode, just shoot him in the big red spot on the opposite side of the cannons. After doing this for a bit, he'll go into offense mode. Just stay in the middle of the big orange beams while making small movements to dodge the small blue balls. Easier to do if you're far away from him. Since you are holding space, you are shooting him whenever you aren't moving (ship auto-orients to face him). After shooting him enough, he goes into stun mode, and again you hit him in the back. Events should go: Start (stun), offense, stun, offense, stun, win.