Does sensor size matter more than megapixels?
Yes, by a considerable margin — and the megapixel number is the figure most heavily marketed and least informative about image quality.
What megapixels actually determine. How many pixels the image contains, and therefore how large it can be printed or how far it can be cropped. Nothing else. Beyond a few megapixels, more resolution adds nothing to a photograph viewed on a screen or printed at ordinary sizes.
What sensor size determines. How much light the sensor collects. A larger sensor gathers more photons for a given exposure, and light is the raw material of a photograph — everything downstream depends on having enough of it.
What follows from a larger sensor:
Better low-light performance, because the signal is stronger relative to the noise. This is the single most visible difference between a phone and a camera.
Greater dynamic range — more detail retained in both shadows and highlights.
Shallower depth of field at equivalent framing, giving the blurred background effect that phones must otherwise simulate in software.
Less aggressive processing required, so images look less artificial.
Why cramming more pixels onto a small sensor can make things worse. Dividing the same area into more, smaller pixels means each collects less light, so noise increases. Manufacturers compensate with pixel binning — combining groups of adjacent pixels into one larger effective pixel — which is why a phone advertising 48 or 108 megapixels typically outputs 12, and why that is sensible rather than dishonest.
The sizes, roughly: phone sensors are small, though flagship phones have grown them substantially; Micro Four Thirds, APS-C and full frame are progressively larger; medium format larger again.
Why phones still take good photographs. Computational processing compensates enormously — stacking multiple exposures, noise reduction and machine learning. In good light the gap is small; in poor light, physics reasserts itself.
What else matters more than megapixels: the lens, the processing, and — overwhelmingly — the light you are photographing in and where you stand.