Nuclear energy is a wonderful energy source for space. As you go away from the sun, solar panels struggle to gather enough energy to run a spacecraft or probe, and chemical rocket fuel tanks would just be too big. Many famous missions depended on nuclear energy (Cassini, Mars Rover, Voyager, etc.).
Cassini, rovers, etc. have been powered by something called a radioisotopic thermal generator (RTG). These devices use radioactive isotopes produced in nuclear reactors on Earth (usually Plutonium-238) coupled to a device that can convert heat directly to electricity. RTGs are kind of like really long-lived batteries that can provide tens or hundreds of Watts for decades.
Nuclear reactors can be used in space to produce heat, electricity, and/or propulsion. They could be used to power a Mars or Moon base or configured as a nuclear-powered rocket to get around out there.
Here’s an excellent summary of nuclear technology in space from an astronuclear engineer named Chris Morrison: