They help the immune system recognize pathogens, but also prevent us from easily transfusing blood or receiving organ transplants.
Antigens, basically cell markers, are used by the immune system to recognize which cells belong in the body and which don’t. So, when bacteria enter the bloodstream, white blood cells can recognize that these bacteria are not part of the body and will immediately kill them.
However, antigens make it difficult for people to receive blood transfusions or organ transplants. If someone receives a blood transfusion or organ from a person with a different blood type, the immune system recognizes that the blood or organ is not part of the body and mistakes it for a pathogen. White blood cells will then attack the blood or organ, causing the person to possibly die.