When using Maven, you only need to have a provided dependency for the servlet API. For "regular" applications that's either javax.servlet:javax.servlet-api or jakarta.servlet:jakarta.servlet-api. Which one depends on the server and version; only the more recent versions will use the Jakarta variant. You just use the API, and because the dependency is provided it won't be bundled with your application. Instead, the servlet container (Tomcat, Jetty, JBoss, etc.) will provide the implementation.
Spring Boot and Quarkus are different though. With these you don't build an application that's deployed in a servlet container. Instead, the bundled application comes with an embedded container that provides the implementation. I think they currently use Tomcat and/or Undertow.