If a proper service seems to help -- on most cars this means dropping and cleaning the tranny pan, replacing the filter, and refilling with fresh fluid -- if that helps but doesn't solve it, then do it all again. Sometimes that will flush it out enough to get it working again. An automatic transmission is configured sort of like a computer, but it works with tubes of oil being pumped around to various circuits, instead of wires with current flowing in them. All those tranny tubes have to be completely free of gunk to ever work correctly. But there's also clutches in auto trannys and those just plumb wear out with use. And no amount of cleaning the tubes is gonna fix that. For that the clutch parts have to be replaced, which is called a transmission rebuild.
The idea proposed by @Keith above is worth a try. If the proper service and that idea has no effect, you pretty much need to get a good transmission shop to help you out. It's possible a diy;er might be able to fix a modern auto tranny by trial and error replacing parts, but usually what happens is you run out of money before you run out of ideas what to replace next. Better to spend that money on buying help from someone with the necessary experience. Best of luck.