Or is there a better way of doing it?
Yes, measure time. Not real time, but game time. You specify an interval to shoot bullets, for example
const sf::Time interval = sf::Milliseconds(200);
Then, you accumulate the frame time
dt (which can be constant or variable) in a counter. If a certain value is reached, reset the accumulator and fire a bullet.
sf::Time accumulator; // member variable
accumulator += dt;
if (accumulator > interval) // or while, if it may happen that frames take that long
{
accumulator -= interval;
fireBullet();
}
Measuring distance is a bad idea, because it depends on the relative velocity of the bullet with respect to the player. Also, you need to keep track of the most recently fired bullet.