1/ make a decision on the largest array you expect and reserve the memory by making a global array with that size. In the code make sure you never write beyond the bounds of the array and decide what to do in case this happens.
2/ handle an unknown size and be ready to deal with issues of reallocating memory dynamically. This comes with possible challenges like poking holes in the heap.
const size_t maxSize = 1000;
uint8_t res[maxSize];
size_t currentPos = 0;
while(UHF.available()){
uint8_t r = UHF.read();
if (currentPos < maxSize ) res[currentPos++] = r;
}
// here you know you have currentPos elements
...
of course you need 1000 bytes freely available....