Indy Cars can be faster, in a straight line, or around an oval circuit – however around a more complex race track they are, by far, much slower than F1.
Both disciplines have a race at The Circuit of The Americas in Texas. The record Lap time around that circuit by an Indy car is 1m 48s (1:48:895); the record lap time by an F1 car is 1m 36s (1:36:169) – nearly 13 seconds faster, in just a single lap. If a car was to win the F1 Grand Prix by 13 seconds you’d say they’d dominated, and that’s over 56 laps. 13 seconds per lap over 56 laps would put the F1 car nearly 8 whole laps ahead in a race against Indy Car (most people would probably choose to retire the car once they’re 2 laps down).
Similarly The LMP1 (Le Mans) cars have a record lap time of 1:47:052 at the same circuit – which puts the F1 car still firmly quicker around a single lap.
Indy and LM cars may be able to achieve a higher top speed, given the right set up and circumstances – but overall F1 beats out nearly all competitors (depending on regulations).
The main difference between all the disciplines is the rules. From race to race an F1 car can’t change all that much. They’re restricted on how many different mechanical parts (i.e. engines) they can use per season before they are penalised, and they’re heavily influenced by every minute detail of their bodywork aerodynamics.
Even if F1 were to race at an oval track – they couldn’t change too much to set the car up specifically for the layout, it would still be mostly the same set up as was used in the previous race, just with lower levels of downforce.
Whereas Indy cars can play around with their set up a little more – even so much as basically have the steering set up so that on banked circuits the driver is practically turning right down the straights and barely turning left on the bends.
LM cars are a different breed altogether – They have to be road-legal models, with minimum production numbers, to begin with (some exceptions can be made to this depending on the class). Recently they also changed the rules regarding the aerodynamics, to try and stop the cars all looking the same (I think there were more reasons than that) – so long as they met the requirements for amount of downforce produced and the drag co-efficient, the car could look however they wanted.
That’s how we ended up with this Peugeot 9X8 Le Mans Hypercar. They were able to meet the downforce and drag requirements without using a rear wing.

Whereas most other LM cars looked like this;

Faster how?
In the tracks they share, F1 are faster by a sizable margin.
IndyCar is faster on ovals, since the cars are specifically setup for them. And LMH (the current top tier of Sports cars) isn’t faster anywhere… there was a highly advertised event where Porsche, after retiring from WEC, modified one of their 919 cars to set track records at Spa and the Nordschleife. However, as soon as F1 raced at Spa the top cars lowered the 919 Evo times (F1 has not raced at Nurburgring in a long time so that record is probably safe). Anyway, note that the regular 919 belong to the previous WEC top class (LMP1), not the current LMH which is a bit slower, besides the fact the 919 Evo did not fit any racing class regulations.
So here’s the apples to apples comparison: the only track where all three series race is COTA (Circuit of the Americas). The last F1 pole was set by Leclerc with a 1′34.7″ lap time. IndyCar hasn’t raced there since 2019, but they still race the same car and engine spec, so no big changes should be expected: back then Will Power set pole with a 1′46.0″ lap time (more than 11 seconds slower than the F1). And LMH raced literally a couple days ago, with the polesitter Giovinazzi scoring a 1′50.4″ in his Ferrari 499P, more than 15 seconds slower than the F1! In a hypothetical race, the F1s would be lapping the LMH every 6 or 7 laps (it would take a little longer to lap the IndyCar, from 8 to 9 laps)