My android phone started doing this recently (S10+) and I can't fix it. Tried gentle cleaning with a q-tip, thin metal etc.
Work around.
Locate and install the Assistive Volume Button app by mCreations.
Grant permissions.
Place it next to your broken volume button on screen by drag and drop (you can also adjust the opacity, size and colour on the free version).
Then under button settings enable System Volume Bar.
Now touching the app buttons opens all 4 sliders on your system volume controls just like tapping the 4 dots on volume up/down would.