Bacterial and viral infections can produce very similar symptoms, such as fever, sore throat, or cough, so the colour of mucus or having a fever alone does not reliably tell them apart. Green or yellow snot, for example, does not mean you need antibiotics.
Clinicians use the pattern and duration of symptoms, a physical exam, and sometimes swabs, urine tests, or blood tests to judge whether bacteria are likely involved. Some infections, like most sore throats and chest colds, are usually viral, while others, like many urinary tract infections, are usually bacterial.
If you are unsure, a telehealth or in-person consultation can help. Seek urgent care for high fever with a stiff neck, confusion, a rash that does not fade under pressure, difficulty breathing, or rapidly spreading redness.