In general there are 3 types of foam used for this.
1. PE Foam (Polyethylene Foam) - IMO the best and most durable foam for holding firearms. It's of a closed cell design and highly resistant to chemicals and moisture. Most companies who do custom foam cases use this type for these reasons.
2. Ester-Foam (Polyurethane Foam) - This is what normally comes in a Pelican case, same as their "pluck-n-pull" foam. It has smaller cells than the the PE Foam and is of an open cell design. I find this important in the event you will be in a wet environment, it will hold moisture. Moisture and firearms are not a good combination when there are better options available.
3. EVA foam (Ethylene-Vinyl Acetate Copolymer Foam) - This is more of a padding, not normally used for firearms. Typically it's what is used for floor mats in a gym or making padding for a bicycle seat. It is a closed cell design, so it will resist water absorption.
I would highly recommend using PE Foam and it can be found on Amazon. I found this in about 10 seconds of searching for only $65. It can be cut down to your specifications easily. YouTube videos abound on how to do this.
https://www.amazon.com/dp/B015JRXH1...Ae4a&ref_=sbx_be_s_sparkle_td_asin_0_img&th=1
There are also custom foam builders out there like My Case Builder and GunFoam.com for a real professional look and color options as well.