Although Layla appeared for just one dialogue in the scene, she performed so well that the director chose to keep it as is

Star Trek IV: The Voyage Home zooms into a voyage the crew undertakes to travel back in time, retrieve two whales, and bring them to the world so they can talk to an alien probe that is destroying the Earth. On a quest to build livable tanks for these creatures, the crew lands in San Francisco, where they meet a gorgeous woman who leaves them with a loopy dialogue. The catch was that this woman, named Layla Sarakalo, was an accidental actor with the funniest backstory, Huffpost reports.
As ironic as it may sound, Sarakalo unsuspectingly ventured into a movie set titled “The Voyage Home” to complete the voyage to her house, except that it wasn’t Star Trek for her, but a car trek. Her short cameo in the 1986 film was a coincidence aligned by a bizarre synchronicity of events. She was a fashion designer whose car had been towed away from the premises because the directors needed to clear the road for shooting.
Sarakalo stayed on the set and played an extra to earn money for getting her car out of the towing impound. As Looper puts it, she delayed her voyage back home to earn money from The Voyage Home and get her car for the voyage.

In the scene titled “Nuclear Wessels,” she appears as a random passerby on the street dressed in a cream-colored top. Pavel Chekov a.k.a. Walter Koenig, and Nyota Uhura a.k.a. Nichelle Nichols stopped her briefly to ask the location of nuclear vessels or “wessels” parked in Alameda, California. They need to reach these vessels to obtain the metal with which they would create a tank for the whales from the past. Another extra, a male character who is standing by a motorcycle, doesn’t answer their question about the location. But Sarakalo enters the scene for not less than 10 seconds, says her dialogue, and walks away, her role looking quite natural in the scene.

When stopped and questioned, Sarakalo casually says, "Ooh, I don't know if I know the answer to that. I think it's across the bay in Alameda," and walks away, shrugging and leaving the two characters dumbfounded, almost like in a bootstrap paradox. Seemingly puzzled by her statement, Chekov tells Uhura, "That's what I said — Alameda. I know that!" It is believed that the director loved the spontaneous dialogue so much that he chose to keep it as it is in the movie, an instance that added Sarakalo’s name to the character list of one of the most epic science-fiction films ever.
Everyone's loving Stacey Abrams' 'Star Trek' cameo, want her to be Earth's president for real
'Star Trek' legend Nichelle Nichols' ashes to head to deep space on a Vulcan rocket
Star Trek's George Takei thought his career was over at 70. He's making his London stage debut at 85