Heavy-ion potentials for ellipsoidally deformed nuclei and application to the system 238U + 238U