I hope we don’t ever have to take guns to space but this is an interesting question from a physics point of view! Let’s assume you’re in open space, vacuum. Guns work by producing a small explosion which fire the bullet and this would normally be a problem in space because there’s no oxygen to act as an oxidiser (fuel). But modern bullets carry their own oxidiser, so shooting the gun isn’t an issue. When you’ve fired the gun the bullet’s going to shoot out of the barrel and thanks to Newton’s third law ( every force has an equal and opposite reaction) it will push back on you too. This is called recoil and on Earth you would normally stop yourself moving by bracing yourself against the ground or something. But if you’re floating in space there’s nothing to brace against so you’ll start drifting backwards – not as fast as the bullet because you’re much larger. Also, if you didn’t fire in line with your centre of mass you’ll probably start spinning slowly too. What happens to the bullet? Theoretically it’s just going to keep going forever! Because the universe is expanding faster than the bullet is moving the bullet will never catch up and there are no particles in the way to slow it down. Depending on where you fired it though it might get caught in a planet or star’s gravity. The same would go for you too by the way, but hopefully you’d have some kind of thrusters on your space suit to get you somewhere safe!