Yes
Nuclear weapons would be highly effective in space.
But their effects are somewhat different than they are on the ground. I recommend reading this entire section of the Atomic Rockets website: Nukes in Space
On the ground, nuclear weapons damage things through 3 mechanisms:
Radiation
Because the atmosphere is opaque to high frequency light (hard UV, XRay, & Gamma Ray), the primary worrisome radiation is neutrons when detonated in the atmosphere (also see thermal flash below).
In space, with no atmosphere, the high frequency light (primarily XRay and Gamma Ray) flies off without interference and this becomes one of the primary danger mechanisms of the nuclear detonation. In an atmosphere, almost all of the high frequency photon energy gets converted into the thermal flash and atmospheric blast mentioned below.
For a conventional nuclear weapon (i.e., NOT a neutron bomb), the
x-ray and neutron flux is approximately:
$F_{XRay} = 2.6 \cdot 10^{27} \times \frac{Y}{R^2}$
$F_{neutron} = 1.8 \cdot 10^{23} \times \frac{Y}{R^2}$
where:
Fx = X-ray fluence (x-rays/m2)
Fn = Neutron fluence (neutrons/m2)
Y = weapon yield (kilotons TNT)
R = range from ground zero (meters)
This shows that for a standard (not neutron enhanced) bomb, XRay radiation is about 10,000x more damaging than neutrons at any given distance from the bomb. Which radiation flux is more dangerous to the crew depends upon factors like what sort of shielding is available and where the crew is located in the ship.
Neutron shielding is best (defined as the least amount of shield mass required to protect against it) composed of low mass atoms (e.g. Hydrogen in water).
What type of shielding to use for XRay and gamma ray radiation depends upon its frequency. At the lower energies, high Z metals (like lead and tungsten) work best, while at higher energies all mass tends to shield about the same.
Since water is terribly useful for spacecraft and ubiquitous across the Universe (from it you can make radiation shielding, water, oxygen, propellant, food, environmental coolant, and for some spacecraft fuel), I'd expect most ships to just use more water shielding in place of their high-Z metal, but otherwise dead weight, gamma ray shielding.
Thermal Flash
Because the atmosphere is opaque to high frequency light (hard UV, XRay, & Gamma Ray), it converts those frequencies to lower frequency light (optical and thermal). This "thermal flash" is what caused memorable images (like the one below) and instantly vaporized some people in Hiroshima:
Nuclear Thermal Flash:
Since there is no atmosphere in space, the "thermal" flash is minimal and not really a concern.
Blast
In an atmosphere part of the energy of the detonation is absorbed by the atmosphere and turned into an atmospheric pressure wave (the "blast" or over-pressure wave). Once again this phenomenon does not occur in space.
Therefore this issue can generally be ignored.
Nuclear Blast Effects:
What it looks like
Assuming a near miss that doesn't actually vaporize the spacecraft...
Read this section of the Atomic Rockets: Nuke vs. Spacecraft section for the entire narrative. I'm going to quote a couple of key passages.
First off, the weapon itself. A nuclear explosion in space, will look
pretty much like a Very Very Bright flashbulb going off. The effects
are instantaneous or nearly so. There is no fireball. The gaseous
remains of the weapon may be incandescent, but they are also expanding
at about a thousand kilometers per second, so one frame after
detonation they will have dissipated to the point of invisibility.
Just a flash.
So a strobe flash. If you were looking at it, you'll be permanently blind if you're too close. If you had a camera/sensor looking at it, it would likely burn out too if it was too close.
Next is spallation - shocks will bounce back and forth through the
skin of the target, probably tearing chunks off both sides. Some of
these may come off at mere hundreds of meters per second. And they
will be hot, red- or maybe even white-hot depending on the material.
To envision the appearance of this part, a thought experiment. Or,
heck, go ahead and actually perform it. Start with a big piece of
sheet metal, covered in a fine layer of flour and glitter. Shine a
spotlight on it, in an otherwise-dark room. Then whack the thing with
a sledgehammer, hard enough for the recoil to knock the flour and
glitter into the air.
The haze of brightly-lit flour is your vaporized hull material, and
the bits of glitter are the spallation. Scale up the velocities as
needed, and ignore the bit where air resistance and gravity brings
everything to a halt.
Followed by a halo of faint hazy "dust" flying away from the hull along with possibly some larger debris ripped off the ship. Some sections of the ship may be glowing red hot (or hotter) depending upon the proximity of the warhead.
It's possible that (depending upon many details) the ship may survive the detonation while the radiation kills the crew quickly or over the course of weeks. If the crew receives a deadly dose of radiation they'll likely know it even if they will likely live for a week or so in increasing agony due to the radiation damage.
Would they go to war?
That's entirely up to you and your fictional Universe.
In space warfare, any target with a predictable trajectory (e.g. not accelerating) is a sitting duck that can be held hostage and/or killed at any time the belligerents decide to strike. The weapons would not need to be nuclear. Given sufficient time, a small asteroid would do the job easily and the belligerents might be able to maintain plausible deniability.