Hardware test: go over to your dial pad and type in *#0*#, this will bring up a number of tests.
One is the speaker.
If this needs to be looked at then a Samsung Experience Store or Samsung Service Centre can run a diagnostic test under the 2 year warranty as long as the phone hasn't been dropped or water has tripped the water indicators.
Current Phone > Samsung Z Fold³ 5G.
Most apps, when they are installed, are set to "optimise" battery usage by default which leads to them being disabled after a short time. Try this
Select any app
Optimise Battery Usage
at the top of the screen change Apps not Optimised to All Apps
Scroll down to Spotify
Make sure the slider is off (no blue)
If that is the problem, then this should fix it.