The bike computer itself can measure speed by the built-in GPS after the satellite signal is located.
When equipped with a speed sensor, the speed is from the speed sensor, which is the same as the speed from GPS.
The only difference is that the speed from GPS may delay, become lower or lose if riding in extremely surroundings like indoors or in the tunnel.
But, the speed sensors won’t be affected by the external environment.
It’s better to equip a speed sensor if riding at the places where GPS signal is not available, like in tunnels, mountainous areas or indoors, or near buildings.
Speed sensors use the size of your bike's wheel and the number of rotations it makes during a cycling activity to determine your distance. The speed at which your wheel rotates will determine speed.
To measure accurate speed, you need to set the correct wheel size.
Read articles to set the wheel size