They are not. The F-35 has a top speed of Mach 1.6. It’s a supersonic aircraft.
The SR-71 has a top speed of Mach 3.2 lol. Literally twice as fast as the F-35 but still well short of the Mach 5 required for hypersonic flight.
The F-35 also has a flight ceiling of 50,000 feet, while the SR-71 has an 85,000 foot ceiling.
The SR-71 served exactly one role: High supersonic aerial reconnaissance. No weapons, nothing. Just fly higher and faster than anything else on the planet.
The F-35 is a strike fighter and air superiority fighter.
They’re really not comparable.