How are scientists able to distinguish between photons?

Photons are smallest quanta of EM (electromagnetic) radiation. How are scientists able to distinguish between photons except by correlating with position in time-space, frequency, spin etc?

For example:

In the article below: How are scientistis able to figure out if a photon from a particular source (gama ray burst from collision of two neutron stars etc). Gama ray photons might have a particular frequency however how are scientists able to figure out that the photons came from a source 7.3 billions years away/ago? Are they using the redshift phenomena? Plus a photon may have acquired a particular frequency due to other interactions, how do scientists know it was the collision of two neutron stars and not any of the numerous events that happen in the universe, for example simply emitted by a "sun-like" object located say, a few light years away?

a photon may have acquired a particular frequency due to other interactions, how do scientists know it was the collision of two neutron stars and not any of the numerous events that happen in the universe

Your question reduces to:

"I receive four visible spectral lines slightly shifted from the lines emitted by burning hydrogen. How do I know I have received spectral lines from a moving source of burning hydrogen and not four lines from a stationary source of something else?"

The answer is that the moving source of burning hydrogen is the most plausible explanation for the lines you received as long as they look like the spectrum of hydrogen but are slightly shifted.