Request recommendations for a putty or foam

If it were me I would tend to use something that will expand and contract with movement.

Foam may not do that well.