Anomalous U(1) models in four and five dimensions and their anomaly poles