That type of foam is not designed to be compressed repeatedly. Its designed to fill a fixed void. It will work in the short term but it will eventually break down due to being compressed. Depending on the frequency of use that may be good enough for your use case. A bottle of foam filler is a lot cheaper than specialized tires though so you may be ahead of the game.