Yes, these buffers can work in a Magpul UBR Gen 2, but it will require the A5 spring if you use this buffer weight.
Yes, the A5 buffers will work in the UBR Gen 2 stocks, but the included tube spacer in the UBR Gen 2 must be removed. This provides sufficient stroke length for the longer A5 buffer. You must also use an A5/rifle spring in this configuration, NOT A CARBINE SPRING.
The A5 system has a unique length buffer tube, different from either carbine OR rifle tubes. That tube uses a standard rifle length spring and an A5 buffer. If you can replace the your buffer tube with one the right length it'll work. If not the rifle will not function properly - FTFs or FTEs and won't cycle. Don't ask me how I know...