They’ll physically fit but the valving and spring rates are quite different - especially the rear
On a Z4 the e46 setup will make the ride quite stiff on the front and bouncy on the rear.... you’ll need either softer rear springs or be able to adjust the damping rate in the rear to make it better balanced