I'm not sure this is going to be really possible without an AI solution, unless you can significantly change the colour of the sandy-looking substance beneath [& also remove anything even vaguely brown-ish from behind the beaker and let your sediment completely settle out of the liquid.].
Image editors, Photoshop et al, don't see 'objects' like we do. If you ask it to select just one brown of a lot of nearly brown, then you have to tell it exactly which brown & how tolerant it has to be of variations in that.
It doesn't know that the top area is a bit lighter because it's illuminated from above, all it sees is a field of brown, from which to choose similar pixels.
I set Photoshop to select 'similar brown' here & after playing with the parameters a while, I got this [highlighted in pink because the 'marching ants' dotted line structure it uses to show the border can sometimes be hard to see in a small image.] Each time I click in a very slightly different place I get a slightly different overall 'map' of similar brown.
As you can see, it can't tell the difference between your sediment's actual depth & the top of the sediment, nor a reflection from the underside of the water surface or in the glass itself.
There's another method to select by colour. This can sometimes be slightly better, but it really is no 'smarter' & for the inexperienced is much harder to figure out.