Dangers of spray foam in body panels?

My 66 Cuda has hard card board material formed to go around the trunk floor/qtr panel
opening, then covered in carpet. Looks nice. Also have 65 Fairlane 500 that uses fiber
board material(factory)laying flat over opening & screwed to trunk floor.