So I had this strange problem where my wifi (broadcom card) would get unstable and the speed drop from around 70MBit/s to around 2MBit/s. After some time I noticed it worked better with the laptop working on battery. The culprit seems to have been tlp, the power management tool. I went into the config file for tlp, /etc/default/tlp, and changed the parameter WIFI_PWR_ON_AC from off to on. After that my wifi has been stable and fast also when plugged in.
Just thought I’d post my solution in case it could help someone else.

Please move this post if I put it in the wrong place. I’m new and don’t know where stuff goes.