Go into the Spotify app on your iPhone and then go into settings.
Then go to devices and turn off the "Devices Lock Screen" option.
This will fix the problem you are having so that it can only be controlled in the Spotify app and not on the lockscreen when the app is in the background.
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.