The short answer is—You can deduct your rental car fees but not your mileage when you use a rental car to drive for rideshare or delivery.
The standard mileage deduction is intended for use on cars that you own or lease, not on cars that you rent. This is because the mileage deduction is inclusive of expenses that you don't incur when renting a car (such as maintenance and car payments).
That being said, you can use the actual expense method—which means that you can deduct the cost of gas.
You would also only deduct the portion of the rental fees that are attributable to your business (for example, if you used the car for business 90% of the time, you would deduct 90% of the rental fees).
Driving the car for any personal errands would be considered non-business use!