Hi Philancy, and welcome to MySwissAlps!
Yes, it is possible to do both.
The Gotthard Panorama Express leaves a bit late in the day to give you much time in Lugano though, as it doesn't get there until 16:38 (and doesn't run on Mondays). If you are traveling second class, be aware that only the first-class carriages have the panoramic windows. Reservations are compulsory in both classes.
If you wanted to make the most of the day by exploring Lugano, which is a lovely lakeside city, and will be at its best in September, you could take a boat and regional train along the same route as the Gotthard Panorama Express, and leave earlier in the day. No reservations are required for either the boat or the regional trains.
After exploring Lugano, and perhaps staying for dinner, you could take the Gotthard-Basistunnel route back to Luzern at the end of the day.
You can use the Swiss Timetable to plan your trip.
To get the Gotthard Panorama route including the boat sector, you will need to do a timetable search in two stages:
- "Luzern Bahnhofquai" to "Flüelen (See)". Use advanced search, and limit the transport type to "Ship".
- "From Flüelen" "To Lugano" "Via Göschenen" and select trains as the type of transport. When you have chosen a connection, click on the plus sign to see the intermediate stops. If they include "Gotthard-Panoramastrecke" this confirms it is the Gotthard Panorama Express route.
For the Gotthard-Basistunnel route, just do a timetable search for Lugano to Luzern (or vice versa), as the Gotthard-Basistunnel route is the default (i.e. fastest) route. In the intermediate stops, you will see "Gotthard-Basistunnel".
I have attached a couple of PDFs showing possible connections leaving Luzern at 8:12 or 9:12 in the last week of September. Those connections utilise regional trains, and would get you to Lugano early enough to have a look around.
The actual Gotthard Panorama Express departs Luzern at 11:12 (boat) and arrives in Lugano at 16:38.