Mr. Dorsey becomes chief executive of Twitter just as Square, which he also heads, is making preparations for an initial public offering.