Speed is not reliable and might not always work, it really depends on how much information your location provide is giving. You can try using a more aggressive update frequency in the appsettings under "Location Updates"
On my Samsung Galaxy A51, speed updates every 4 minutes and only displays average speed. I have not found a way to improve it.