Actors, Crew and equipment are all valuable -- shooting scenes in a burning building seems particularly impossible to do safely, but at the same time when watching these scenes, it's doesn't appear to (always) be CGI, and of course that wasn't available until recently anyway. To that end, how are scenes in burning buildings filmed?
Bear in mind that even before CGI there were techniques to use different footage sources to make the final composite scene - so "the fire was added afterwards" is always a valid method.
There are, however, various method of being able to put actor and fire in apparent close proximity.
A lot of methods make use of controlled fire, rather than 'wild' - so, gas jets and ceramic objects, not actual burning materials.
The first would be "Use a longer lens"
It's a feature of the focal length of a lens that the longer it is, the more distances appear to be compressed. Putting the actor 10ft behind a real fire and using a long lens will immediately put them closer, from the audience's perspective.
Second would probably be "Don't use an actor"
Stunts have been used in a myriad of scenes where the actor's face isn't clearly seen. Protective clothing, gel and face masks, often a rough cast of the real actor's face, can be worn as protection. Actors have been known to get involved in this themselves - iirc, Backdraft was one - but they would undertake some proper training first.
I spent a month on a movie this summer which used a lot of controlled fire.
At all times, there is a professional fire crew in attendance, right there, just out of shot. These days they constantly monitor the area with infra-red viewers, checking for hot spots invisible to the naked eye.
It all used to be done with propane. Sort of like a gas fireplace. Just put bunches of pipes behind, or inside, specially made "logs" that don't burn. The only danger was to actors who got too close to the flames, but there are plenty of people with fire extinguishers just off camera.
For certain scenes where stuntmen are involved they will use real fire, but the stuntmen are usually coated with fire-retardant gel and wearing fire-resistant clothing. Then, again, the people with extinguishers are just off camera waiting for the director to yell "Cut!"