UTe$_2$ is a recently discovered unconventional superconductor that has attracted much interest due to its many intriguing properties - a large residual density-of-states in the superconducting state, re-entrant superconductivity in high magnetic fields, and potentially spin-triplet topological superconductivity. Our ac calorimetry, electrical resistivity, and x-ray absorption study of UTe$_2$ under applied pressure reveals key new insights on the superconducting and magnetic states surrounding pressure-induced quantum criticality at P$_{c1}$ = 1.3 GPa. First, our specific heat data at low pressures, combined with a phenomenological model, show that pressure alters the balance between two closely competing superconducting orders. Second, near 1.5 GPa we detect two bulk transitions that trigger changes in the resistivity which are consistent with antiferromagnetic order, rather than ferromagnetism. The presence of both bulk magnetism and superconductivity at pressures above P$_{c2}$ = 1.4 GPa results in a significant temperature difference between resistively and thermodynamically determined transitions into the superconducting state, which indicates a suppression of the superconducting volume fraction by magnetic order. Third, the emergence of magnetism is accompanied by an increase in valence towards a U$^{4+}$ (5f2) state, which indicates that UTe$_2$ exhibits intermediate valence at ambient pressure. Our results suggest that antiferromagnetic fluctuations may play a more significant role on the superconducting state of UTe$_2$ than previously thought.