How close to the top should I fill a pie to avoid overflow?
A basic bechemel or broth based pot-pie filling will not expand significantly when being baked.  It may bubble a little under the pastry from being simmered.

You would the casserole up to maybe 1/2 inch (1 cm) below the lip, and apply pastry on top of that.

Less is fine if you have less filling.