Aromatic infrared bands (AIBs) are a set of broad emission bands at 3.3, 6.2, 7.7, 8.6, 11.2, and 12.7 mu m, seen in the infrared spectra of most galaxies. With the James Webb space telescope (JWST), the 3.3 mu m AIB can in principle be detected up to a redshift of $ 7$. Relating the evolution of the 3.3 mu m AIB to local physical properties of the interstellar medium (ISM) is thus of paramount importance. By applying a dedicated machine learning algorithm to JWST NIRSpec observations of the Orion Bar photodissociation region obtained as part of the PDRs4All Early Release Science (ERS) program, we extracted two template spectra capturing the evolution of the AIB-related emission in the 3.2-3.6 range, which includes the AIB at 3.3 and its main satellite band at 3.4 um. In the Orion Bar we analyzed the spatial distribution of the templates and their relationship with the ro-vibrational H$_2$ line at 2.12 the pure rotational line of H$_2$ at 4.69 and the Pfund delta line at 3.29 um. We find that one template (AIB$_ Irrad $) traces regions of neutral atomic gas with strong far-UV fields, while the other template (AIB$_ Shielded $) corresponds to shielded regions with lower FUV fields and a higher molecular gas fraction. We then show that these two templates can be used to fit the NIRSpec AIB-related spectra of nearby galaxies. The relative weight of the two templates (AIB$_ Irrad/Shielded $) is a tracer of the radiative feedback from massive stars on the ISM. We derive an estimate of AIB$_ Irrad/Shielded $ in a $z=4.22$ lensed galaxy and find that it has a lower value than for local galaxies. This pilot study illustrates how a detailed analysis of AIB emission in nearby regions can be used to probe the physical conditions of the extragalactic ISM.