If work is a scalar measurement, why do we sometimes represent it as the product of force (a vector) and distance (scalar)?

Work is the dot product of a vector force and a vector displacement, hence a scalar.

Knowing just the scalar distance isn’t enough to calculate work. That distance might be in the same direction as the force, but it might be perpendicular or even opposed. All of those would give different values for the work done.

The general definition of work is $$W=\int\mathbf F\cdot\text d\mathbf x$$ Which essentially says, "Add up all of the dot products between the vector force $\mathbf F$ and the vector displacement $\text d\mathbf x$ along the path the object travels on." Since we are adding up dot products, which are scalar quantities, the work done by a force is also a scalar quantity.

The confusion might arise with specific cases. For example, if the force is always points parallel to the path, then the dot product becomes the product of the magnitudes $$W=\int F\,\text dx$$

And then if the force is constant in magnitude we get the "algebra based physics work" $$W=F\int\text dx=F\Delta x$$

But now we have a scalar force magnitude $F$ multiplied by a scalar distance $\Delta x$. In this equation $F$ is not a vector, but rather its magnitude, and $\Delta x$ is not a vector, but rather it is the total path length.

With work you will never have a vector multiplied by a scalar, since that will result in a vector quantity, which doesn't work (pun always intended) because work is a scalar quantity.