Screen Time works by monitoring time spent on apps that are in the foreground (visible on the screen), it does not monitor or block apps that are running in the background (like music apps), or widgets that run on the home screen.
We are always working on improving Screen Time and we hope that in the future we’ll be able to monitor these types of apps as well.