Sounds like either a faulty speaker (if you only have a single one, unusual I appreciate) or the speaker socket switches are going faulty. If you plug a set od headphones into their socket it operates ca switch which disconnects the connection to the speakers. When you remove the headphones the switch contacts close again. I would suppose that the springiness in the contact has been lost and the contact is poor. When a loud sound is produced it vibrates the switch contact which opens and then closes again. Try opening the case and looking at it. It may also benefit from the contacts being cleaned with "Contact Kleena" on the other hand it may not and require a replacement socket.
OnePlus 6 review: Hands-on