It is used for exchange of clinical data like admission notifications and health records. X12 is used for administrative data like enrollment and claim submission. I have worked with both.
HL7 is a standards development organization, not a data exchange format. They publish several major standards including V2 Messaging, CDA, and FHIR.