Elements heavier than iron are produced mainly by neutron-capture inside stars, or during neutron star mergers (see below, although there are other more minor contributors cosmic ray spallation, radioactive decay). The reason for this is that fusion producing elements beyond iron is strongly disfavoured by (i) the large Coulomb barrier and (ii) that if temperatures get high enough to circumvent the Coulomb barrier, then photons in the gas will have enough energy to disintegrate nuclei. Neutron capture faces no Coulomb barrier.
The elements beyond iron are not only produced in stars that explode as supernovae. This has now been established fact since the detection of short-lived Technetium in the atmospheres of red giant and AGB stars in the 1950s (e.g. Merrill 1952), and it requires continual correction of this pop-sci claim more than 60 years later (e.g. here).
Neutron capture can occur rapidly (the r-process). Rapid here, means the neutron capture timescale is short compared with the decay timescale of the products. This process occurs could inside and during supernova explosions but perhaps more readily during the merger of neutron stars. The free neutrons in a supernova are created by electron capture in the final moments of core collapse. At the same time this can lead to the build up of neutron-rich nuclei and the decay products of these lead to many of the chemical elements heavier than iron once they are ejected into the interstellar medium during the supernova explosion.
In neutron star mergers, the sources of free neutrons is rather obvious, but the seed nuclei are also present in abundance in the neutron star crust and in fact the release of this material into a low-density environment means that much of this neutron-rich material will in any case decay into more familiar heavy elements.
The r-process is almost exclusively responsible for elements heavier than lead and contributes to the abundances of many elements between iron and lead. Rapid neutron capture will "stall" once nuclei are produced with magic numbers of neutrons (50, 82, 126) in closed shells. These nuclei will however be far from the valley of stability and they beta-decay back to a position in this valley such that there are three peaks in abundance for stable elements with atomic mass about $\sim 5-10$ below nuclei with magic numbers of neutrons on the stability line (produced in the s-process, see below).
There is still ongoing debate about the site of the primary r-process. My judgement from a scan of recent literature is that whilst core-collapse supernovae proponents were in the majority, there is a growing case to be made that neutron star mergers may become more dominant, particularly for the r-process elements with $A>110$ (e.g. Berger et al. 2013; Tsujimoto & Shigeyama 2014). In fact some of the latest research I have found suggests that the pattern of r-process elemental abundances in the solar system could be entirely produced by neutron star mergers (e.g. Wanajo et al. 2004), though models of core-collapse supernovae that incorporate magneto-rotational instabilities or from rapidly-rotating "collapsar" models, also claim to be able to reproduce the solar-system abundance pattern (Nishimura et al. 2017). Since, the merger of neutron stars takes some time (perhaps $\geq 100$ million years) then sone supernova contribution may be necessary to explain the enhanced r-process abundances (particularly Europium) found in some very old halo stars (see for example Brauer et al. 2020).
Significant new information on this debate comes from observations of kilonovae and in particular, the spectacular confirmation, in the form of GW170817, that kilonovae can be produced by the merger of two neutron stars. Observations of the presumably neutron-rich ejecta, have confirmed the opacity signature (rapid optical decay, longer IR decay and the appearance of very broad absorption features) that suggest the production of lanthanides and other heavy r-process elements (e.g. Pian et al. 2017; Chornock et al. 2017). Whether neutron star mergers are the dominant source of r-process elements awaits an accurate assessment of how frequently they occur and how much r-process material is produced in each event - both of which are uncertain by factors of a few at least.
A paper by Siegel (2019) reviews the merits of neutron star merger vs production of r-process elements in rare types of core collapse supernovae (aka "collapsars"). Their conclusion is that collapsars are responsible for the majority of the r-process elements in the Milky Way and that neutron star mergers, whilst probably common enough, do not explain the r-process enhancements seen in some very old halo stars and dwarf galaxies and the falling level of europium (an r-process element) to Iron with increased iron abundance - (i.e. the Eu behaves like the "alpha" elements - oxygen and neon that are produced in supernovae).
The debate continues...
However, many of the chemical elements heavier than iron are also produced by slow neutron capture - where the neutron capture rate timescale is on general longer (hundreds or even thousands of years) than product decay timescales; the so-called s-process. The free neutrons for these low-flux, neutron-capture events come from alpha particle reactions with carbon 13 (inside asymptotic giant branch [AGB] stars with masses of 1-8 solar masses) or neon 22 in giant stars above 10 solar masses. After a neutron capture, a neutron in the new nucleus may then beta decay, thus creating a nucleus with a higher mass number and proton number. A chain of such events can produce a range of heavy nuclei, starting with iron-peak nuclei as seeds. Examples of elements produced mainly in this way include Sr, Y, Rb, Ba, Pb and many others. Proof that this mechanism is effective is seen in the massive overabundances of such elements that are seen in the photospheres of AGB stars. A clincher is the presence of Technetium in the photospheres of some AGB stars, which has a short half life and therefore must have been produced in situ.
Nuclei with magic numbers of neutrons prove particularly stable, so there is a "pile-up" in the abundances of s-process elements in the valley of stability associated with the three magic numbers, e.g., Sr-88 (N=50), Ba-138 (N=82), Pb-208, Bi-209 (N=126).
According to Pignatari et al. (2010), models suggests that the s-process in high mass stars (that will become supernovae) dominates the s-process production of elements with $A<90$, but for everything else up to and including Lead the s-process elements are mainly produced in modest sized AGB stars that never become supernovae. The processed material is simply expelled into the interstellar medium by mass loss during thermal pulsations during the AGB phase.
The overall picture
As a further addition, just to drive home the point that not all heavy elements are produced by supernovae, here is a plot from the epic review by Wallerstein et al. (1997), which shows the fraction of the heavy elements in the solar system that are produced in the r-process (i.e. an upper limit to what is produced in supernovae explosions). Note that this fraction is very small for some elements (where the s-process dominates), but that the r-process produces everything beyond lead.
A more up-to-date visualisation of what goes on (produced by Jennifer Johnson) and which attempts to identify the sites (as a percentage) for each chemical element is shown below. It should be stressed that the details are still subject to a lot of model-dependent uncertainty.
An even more recent version of this diagram is provided by Arcones & Thielemann (2022). If you look carefully there are some minor differences between these two diagrams (e.g. Bi).