I see you’re asking questions in two areas ,
You can use blue sheet foam for this purpose but if you are experiencing cold winters (freezing temperatures) and especially if your chimney is on an exterior wall, I would still recommend fiberglass. You can get a roll of unfaced fiberglass insulation for under $10, it will seal the flue better because it expands slightly.
If freezing temperature is not an issue you might be OK with what you have. Whatever you do, make sure that the water heater is not using the same chimney flue for venting and you’re not going to block it unintentionally.