I've just checked today's (Thursday's) schedule for the trains to Figueres Vilafant, and most of them are either sold out or have only handicapped places available; I believe those don't have comfortable seats. There are a few AVANTS that aren't sold out, and their fare is under 18 euros one way, which isn't too bad. There are three other trains that have seats available, but only if you are willing to pay at least 55.75 euros one way. (I hope you really, really like Dali.) So i'd say waiting until the day you need to make the trip seems quite risky.
You might save considerable money by buying fast-train tickets ahead of time. Of course, you may have very good reasons for not wanting to do that.
There are also slower trains going to a second station in Figueres, called simply "Figueres". Fares on those trains are fixed; you will not pay more for those tickets if you buy them on the day of travel, and the amount will probably be quite different from the cost of fast-train tickets purchased on your travel day. There are no seat assignments on the slowe trains, so they never sell out.
Tickets for those trains aren't sold online, so I can't tell you exactly what they cost.
Use the Renfe website to explore schedules. You'll need to search separately for the fast trains (Figueres Vilafant) and the slow trains (Figueres) since the destination stations are different. https://www.renfe.com/es/en
The Figueres station is a bit closer to the Dali Theatre-Museum than the Figuere-Vilafant Station. As I recall, it's not all that much closer, but you can check the distance on Google Maps to see whether the difference would be significant to you.
There's a bus that runs between the two train stations and passes within a few blocks of the Dali Theatre-Museum. It seemed to be timed to meet the fast trains; you should have no trouble finding that bus, because it stops right in front of the Figueres Vilafant Station. However, if the train you take happens to run late (as mine did), the bus doesn't hang around to wait for the train, at least not very long (in my experience). In that case, you'll need to walk or try to get a taxi. There might well be a taxi waiting at the station. In any case, it's important to go right out the front of the train station when your train arrives if you hope to take either the bus or a taxi. If you're not okay with walking to the museum, I recommend Googling for phone numbers for Figueres taxis so you'll be prepared.
To return to the station you'll need to walk a few blocks from the museum to the bus stop. I'm sure the folks at the museum will be able to tell you where to stand. i believe there's a bus shelter, and it probably has some sort of information posted nearby that indicates what buses stop there. There's a good chance this information is online; you may be able to find it if you poke around a bit.