Based on both answers above, this is the minimum code I could get it to work on .NET 8.
//1. Add SwaggerUI
app.UseSwaggerUI(c =>
{
c.RoutePrefix = "api/something/else/swagger";
});
//2. Set BasePath
app.UsePathBase("/api/something/else");
//3. Add Swagger
app.UseSwagger();