The main options are:
1.) use if-generate to select a module at time of synthesis. The other module is not included in the design.
2.) instantiate both modules, use some logic on the input/output to deal with the selection process.
3.) create a module that can perform both functions. This takes more effort to design and test. This only works if the modules are similar.
There are also methods based on building multiple FPGA configurations or using partial reconfiguration. These involve reprogramming the fpga, or part of the fpga. Partial reconfiguration makes it more difficult to design the project overall.