Best practice would be the Ui completely separate from the function.
In fact, any function that can be called remotely should just use a blueprint interface.
The object will implement the interface however it sees fit.
The UI will send the call off to the function.
Now with that said, if your player directly interact with a building to issue a destroy command, you spawn the UI from the building click.
You can obviously always find the player controller and call a “spawn” method you create.
It’s actually easier in the long run for RTS type games where you can ineract with a billion things.
It forces you to create a “standard” template that gets updated based on what type of building was clicked (passe along to the function in player controller).
So make a standard widget, create a custom event, add an “actor” parameter to it so you can test and change the look/name etc - or, even better parameterize everything and add it as pins to the event.
Image, name, status, whatever else may be relevant. OR even even better, make a Struct with what you need and pin that.
Then when you call the event you can break the pin or create the struct ad-hoc for every base item type that generates the interface when interacted.