Is a gamma ray burst cylindrical (like a beam) or a cone? Could one hit both Earth and Mars at the same time? I've always seen a GRB as a beam in various depictions. Can this beam be as wide as the distance from Earth to Mars? As in, could the beam be 400 million km in width as it travels through space?
Or is there a different shape to it? I'm unsure if it's like a cone where it spreads out, and if the concept of a beam is wrong.
 A: Gamma-ray bursts are thought to be correlated to supernova or hypernova eruptions.
In 1987 there was a prominent supernova eruption called SN1987A
at a distance of $168000$ light-years (in the Large Magellanic Cloud,
a small neighbor galaxy of our Milky Way).
The article "Determining the jet opening-angle of gamma-ray bursts"
sugggests this supernova had also emitted a gamma-ray burst
(which obviously was not directed to us).
And they estimate its opening angle to be around $6°$.
Therefore its gamma-ray burst, if it would have been directed to us,
when hitting us would have been spread out to a diameter of around
$17000$ light-years.
This is much larger than the size of our solar system (a few light-hours).
And anticipating your next likely question: Supernovas near enough
to harm us by its gamma-ray burst are extremely rare.
There is just one such event in geological time
(the mass extinction 440 million years ago)
which may have been caused by a gamma-ray burst.
See the article "Did Gamma Rays Cause Ordovician Mass Extinction?".
