a few different ways…
if you know the speed of a bullet, you can pre calculate how long it should be alive s=d/t
then after that time has past since firing… kill the object.
each Update just accumulate time its been alive. aliveTime += Time.deltatime
This would be the fastest, most performant way.
or…
in each Update… accumulate the distance moved with an a vector add. totalMoved += movedVector,
then check the squareMagnitude, to see if it passed max distance.
if(totalMoved.SqrMagnitude > maxSquared). then kill object.
or subtract bullets starting position from current position… to get a totalMoved. vector, and again check square magnitude.
Note:- squareMagnitude is much cheaper than checking magnitude (length) of a vector. So you should calculate maxSquared in Start(). and use that, to keep things performant.