Another graphical, dynamic and most importantly simple way to detect duplicate attributes: use QGIS's expression builder.
Highlight duplicates in attribute table:
Suppose FieldWithDuplicates is the attribute containing duplicates ( TreeID in the screenshot below).
Enable Conditional Formatting (see red arrow below) with the following condition:
count(1,"FieldWithDuplicates") > 1
To group all duplicates at the top, right click the column, select Sort
Enter the above expression without the >1, and deselect Sort ascending.

Highlight features with duplicate attributes on canvas:
You could add a new symbol or label with the filter set to the above condition.
And of course you can enable a data derived override based on the the same.
For example, if you want to highlight labels for features with a duplicate attribute, you can set it to draw a label background with the following override:
count(1,"FieldWithDuplicates") > 1
to achieve something like the following

In both situations, of course, once you either delete or change the duplicate attributes, the formatting/styling updates instantly.
count()here, the important thing is what attribute it is grouped by (i.e. the attribute that we want to find duplicates in). In this case there is no difference if it is countingTreeID(for the five features above - T1019; T1020; T1021 + T1021; T1021 + T1021; T1023), or the value1(1; 1; 1+1; 1+1; 1), the count of values is still 1; 1; 2; 2; 1 – she_weeds Dec 22 '22 at 09:47