Legacy extensions are macOS kernel extensions that will be going away next year (maybe about a year and a quarter) when the next major macOS release happens After Big Sur macOS 11 is released this Fall.
Things like Avast install the kernel extensions that you are being warned about, along with just about every other anti-virus package. So if you install Avast, you will just continue to get Legacy kernel extension warnings.
You can run EtreCheck
http://EtreCheck.com
and it will list out all the kernel extensions you current have installed.
You can go through the list and decide on what you need to either remove, or contact the vendor and ask if they are going to have an update before Fall of 2021.
Until the Fall of 2021 you do not need to do anything. Your Mac will continue to function as is. If you do not install the next major macOS release after Big Sur, then you can continue to use macOS as is for a few more years.