If your goal is durability and a lifelike appearance, cork is the better choice, hands down. It’s heavier than foam, but still flexible enough to shape around your layout. Most importantly, it won’t sag or lose its form under track weight.
Cork also does a superior job of absorbing sound and dampening vibrations, which helps your trains run smoother and quieter. Foam is budget-friendly, but doesn’t offer much in terms of noise reduction or long-term support.
From a visual standpoint, cork wins again. It naturally blends into scenery, while foam can come off looking too polished or artificial, which can ruin the realism of your setup.