I’d avoid standard expanding foam it’s not usually rated for fire doors unless it’s a specific fire-rated type. Intumescent paste or filler is much safer. You could also use hardwood plugs if it's a bigger cavity, but check it won’t affect the door's integrity. Definitely worth asking the inspector if in doubt!