In your case you are missing the latest 3.1.* patch. You should install it. You really only need the lastest patch for each x.x version you use.
For example 2.1 will reach end of support next month. You should really migrate your code off of it to a later version.
To delete extra versions see
https://learn.microsoft.com/en-us/dotnet/core/install/remove-runtime-sdk-versions?pivots=os-windows