That is NOT OK.
The grounds and the neutrals should be on different bars. Eventually, the neutral IS grounded, usually in one spot. But mixing the grounds an neutral on the same bars is not done.
Here is an example.
https://diy.stackexchange.com/questions/1706/is-it-ok-to-have-mixed-grounds-and-neutrals-on-bars-in-a-breaker-box
I am not sure about the specific spray foam insulation, but that does not look like fireproof. If arcing occurs on a loose wire, it could ignite the insulation.
I think you need to get a professional in there to look at this.