I don't really know what I'm doing with GIS but I wanted to achieve the same outcome as the OP. I'm on QGIS 3.16.0-Hannover and the existing answers didn't give me what I need (and they don't seem to live in the same spot in my version). I have a raster with a single band of values.
I found the Raster layer unique values report
from the Processing Toolbox
to be exactly what we're after. The description of this report is:
This algorithm returns the count and area of each unique value in a given raster layer.
In the UI, you can find it here:

The output looks like:
Analyzed file: /vsigzip//tmp/south_australia_landcover.tif.gz (band 1)
Extent: 967587.0000000000000000,1315841.0000000000000000 : 1528884.0000000000000000,1962113.0000000000000000
Projection: GDA94 / SA Lambert
Width in pixels: 17009 (units per pixel 33)
Height in pixels: 19584 (units per pixel 33)
Total pixel count: 333104256
NODATA pixel count: 167256799
Value Pixel count Area (m²)
0 649033 706796937
110 11211 12208779
111 6832690 7440799410
112 1716817 1869613713
113 2899563 3157624107
114 811580 883810620
115 41014 44664246
116 374 407286
117 7973916 8683594524
...and so on