Would a multi-stage linear solenoid work?
Multiple coils would make a linear motor, but requires that you switch the
coils sequentially to keep the core moving.  You can, by switching the coils, move forward or backward, at any speed.  A simple solenoid is usually
ON/OFF operated and moves a short distance against a spring or gravity.
A coilgun is a linear motor, too (but usually only operates forward at full
acceleration).